On 12/22/2012 3:18 PM, Fraser Baker wrote:
Hi Y'all:
I have a four segment string delimited by '::'.
How can one stop a substitution regex at the first encounter of the
'::' symbol?
How can one say stop the substitution at the second encounter of a the
'::' symbol?
Fraser
This did what I think you wanted to do:
s/^[^:]*::/whatever::/;
s/^([^:]*::)[^:]*::/$1whatever::/;
________________________________________________________
#!/usr/local/bin/perl
use strict;
use warnings;
while (<DATA>) {
# s/^[^:]*::/whatever::/;
s/^([^:]*::)[^:]*::/$1whatever::/;
print;
}
__DATA__
one::two::three::four
one2::two2::three2::four2
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/