On Wed, Mar 07, 2007 at 02:54:15PM +0800, Jm lists wrote:
> Hello,
> 
> $s="hello,test";
> 
> the 1st statement:
> $s=~s/^(\w+)/$1 0000/
> 
> the 2nd statement:
> $s=~s/^(\w+)/\1 0000/
> 
> 
> What's the difference between these two statements?
> Thanks!




What was the output of your test script to find out?

Try this



Owen


========================================
#!/usr/bin/perl -w

use strict;
my $s="hello,test";

#the 1st statement:
$s=~s/^(\w+)/$1 0000/;
print "\$s from the first statement is $s\n";

$s="hello,test";

#the 2nd statement:
$s=~s/^(\w+)/\1 0000/;
print "\$s from the second statement is $s\n"



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to