No matter what, the OP's code is bizarre.use strict; use warnings; my $x = 'a34x5'; my @y = $x =~ /([\d]+)/g; my @z = $x =~ /([0-9]+)/g; print "@y\n"; # 34 5 \d worked fine print "@z\n"; # 34 5 my @b = $x =~ /([\d\w]+)/g; print "@b\n"; # a34x5 \d irrelevant but \w works my @c = $x =~ /([\w]+)/g; #brackets not needed print "@c\n"; #a34x5 my @d = $x =~ /(\w+)/g; print "@d\n"; #a34x5
Added: The idea of using an anchor to the beginning of the string, followed by any amount of random stuff, makes no sense to me. Better to leave that off entirely (don't put /^.*(match)/, just put /(match)/.
I think if you want \ in the character set, you have to escape it with another \
In reply to Re^3: In my it is printing in the else i want to get output for the for loop in linux.
by Marshall
in thread In my it is printing in the else i want to get output for the for loop in linux.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |