home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cse.unsw.edu.au
/
2014.06.ftp.cse.unsw.edu.au.tar
/
ftp.cse.unsw.edu.au
/
pub
/
doc
/
languages
/
perl
/
nutshell
/
ch3
/
getline
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1992-10-18
|
357 b
|
21 lines
#!/usr/bin/perl
# get a line, combining continuation lines
# that start with whitespace
sub get_line {
$thisline = defined($lookahead) ? $lookahead : <STDIN>;
line: while ($lookahead = <STDIN>) {
if ($lookahead =~ /^[ \t]/) {
$thisline .= $lookahead;
}
else {
last line;
}
}
$thisline;
}
while ($_ = &get_line()) {
# Your code here.
}