[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] [Q] use of $1, $2...



Hello,

I have a script like this:

$_ = " abcde. egi";

if (/^(.+\.)([^\.]*)/) {
	$a = $1;
	$a =~ s/ //;
	$b = $2;
}

print "a = $a, b = $b\n";

When I run this script, the result is:

a = abcde., b =

But if I comment out the line "$a =~ s/ //;", I get the expected result:

a =  abcde., b =  egi

Must I think that something is changed in $2 when I remove the space in $a??

Thank you in advance for any explanation.

Nobumi Iyanaga
Tokyo,
Japan



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch