Perl gods: Help needed
Kevin D. Clark
kclark at CetaceanNetworks.com
Tue Jan 20 00:39:46 EST 2004
Joshua Pollak writes:
> What's the best way to do this?
This comes to mind:
#!/usr/bin/perl
use strict;
my ($line);
while (defined($line = <>)) {
chomp;
if ($line =~ s/\\$//) {
$line .= <>;
redo unless eof;
}
if ($line =~ /^\s*OPTION\s*=\s*(.*)$/s) {
my (@options) = split(/\s+/, $1);
# do something with @options
for my $option (@options) {
print "option is $option\n";
}
exit; # Joshua said that he wanted to stop reading here
}
}
Hope this helps,
--kevin
--
Kevin D. Clark (cetaceannetworks.com!kclark) | Will hack Perl for
Cetacean Networks, Inc. | fine food, good beer,
Portsmouth, N.H. (USA) | or fun.
alumni.unh.edu!kdc (GnuPG ID: B280F24E)) |
More information about the Discuss
mailing list