in reply to Can't use string ("1") as a SCALAR ref while "strict refs" in use
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't use string ("1") as a SCALAR ref while "strict refs" in use
by kennethk (Abbot) on Mar 09, 2010 at 15:25 UTC | |
|
Re^2: Can't use string ("1") as a SCALAR ref while "strict refs" in use
by Anonymous Monk on Mar 09, 2010 at 15:23 UTC | |
by ikegami (Patriarch) on Mar 09, 2010 at 15:29 UTC | |
by ikegami (Patriarch) on Mar 09, 2010 at 19:28 UTC | |
by ssandv (Hermit) on Mar 09, 2010 at 19:13 UTC | |
|
Re^2: Can't use string ("1") as a SCALAR ref while "strict refs" in use
by pemungkah (Priest) on Mar 09, 2010 at 23:26 UTC |