Try it like this: \(&mysub(<$1> <$2>));
#!/usr/bin/perl -slw use strict; use re 'debug'; sub mysub { die 'single word expected' if (my $name = shift @_) =~ /^\w+$/; die 'single word expected' if (my $value = shift @_) =~ /^\w+$/; } my $str = 'abc def'; $str =~ /(\w+)\s+(\w+)/; print "\(&mysub(<$1> <$2>))";
In reply to Re: unexpected: inside sub($1,$2) if do // then arguments will be changed
by Khen1950fx
in thread unexpected: inside sub($1,$2) if do // then arguments will be changed
by bdimych
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |