in reply to Exiting subroutine via next (that old chestnut)
but you could also dosub RemoveComments { my $line=$_[0]; $$line =~ s/#.*$//; # No need for a separate pattern match } .... while ($temp=<INPUT>){ RemoveComments(\$temp); if ($temp =~ /\S/){ ... some other code ... } }
while ($temp=<INPUT>){ RemoveComments(\$temp); next if ($temp !~ /\S/); ... some other code ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Exiting subroutine via next (that old chestnut)
by why_bird (Pilgrim) on Mar 04, 2008 at 17:28 UTC | |
by nefigah (Monk) on Mar 04, 2008 at 20:59 UTC |