Hello Monks,
Below are some snippet codes that i don't understand the behavior, please help:
First case:
my $foo = "weird123"; my $result = $foo.($foo =~ s/123//?$foo:""); print $result; # "weirdweird"
Second case:
my $foo = "weird123"; my $result = "".$foo.($foo =~ s/123//?$foo:""); #or: my $result = $foo."".($foo =~ s/123//?$foo:""); print $result; # "weird123weird"
I already had a discussion with one fellow monk, he thought that the "" is forcing the left side of "." executed first before the substitution. He was also not sure so i ask this to make us understand better.
Thanks in advance!
In reply to Strange behavior by redbull2012
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |