On Wed, 24 Nov 2004, FlashMX wrote:
> Right...but my problem is I don't want the substitutions to happen on
> ALL the lines matched.
Fine then.
$line = sub_one( $line ) COND;
Where COND is any condition you specify, e.g.
$line = sub_one( $line ) if ( $line =~ /pattern one/ );
$line = sub_two( $line ) unless ( $line =~ /pattern two/ );
Of you can put the logic in the hypothetical subroutine:
sub sub_one {
return $_ unless ( $_ =~ /pattern one/ );
...
}
But I think putting the condition in the first way is clearer here.
--
Chris Devers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>