What part of
Can't use string ("1") as a SCALAR ref while "strict refs" in use at . +... line 6.
do you have a problem with? You seem to be trying to use symbolic references for a really minor task, and strict forbids that, for good reason.
Most likely, you wanted:
my %values = ( a => 'value a', b => 'value b', c => 'value c', d => 'value d', ); if( $str=~ m/(\S)\s(\S)\s(\S)\s(\S)/) { my @captured = ($1, $2, $3, $4); ($a,$b,$c,$d)= map { $values{ $_ } || $_ } @captured; }; print $a,"\n",$b,"\n",$c,"\n",$d;
Maybe you want to use a real templating system instead.
In reply to Re: Can't use string ("1") as a SCALAR ref while "strict refs" in use
by Corion
in thread Can't use string ("1") as a SCALAR ref while "strict refs" in use
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |