johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
my @data = <DATA>; print "Using lexical varible:\n"; foreach my $line (@data){ if($line =~ /begin/../end/){ print $line; } } print "\nNot using lexical varible:\n"; foreach (@data){ if(/begin/../end/){ print; } } __DATA__ before begin 1 2 3 end after __RESULT__ Using lexical varible: begin 1 2 3 end after Not using lexical varible: begin 1 2 3 end
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: why doesn't this flip-flop work?
by japhy (Canon) on Jan 27, 2006 at 19:42 UTC | |
|
Re: why doesn't this flip-flop work?
by Roy Johnson (Monsignor) on Jan 27, 2006 at 19:42 UTC |