in reply to Use of uninitialized value in concatenation
will produceuse strict; use warnings; my %words = map { $_ => 1 } qw($Word $name $test); my $line = '$Word $ $ $ $test'; $line =~ s/(\$\w*)/exists $words{$1} ? $1 : " dollar "/eg; print "$line\n\n";
UPDATE
thanks AnomalousMonk, actually i misunderstood the problem :)
this could do it
$line =~ s/(\$(\w*))/exists $words{$1} ? $1 : "dollar$2"/eg;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use of uninitialized value in concatenation
by AnomalousMonk (Archbishop) on Jun 11, 2009 at 06:07 UTC | |
by gem555 (Acolyte) on Jun 11, 2009 at 11:20 UTC | |
by AnomalousMonk (Archbishop) on Jun 11, 2009 at 15:20 UTC | |
by Anonymous Monk on Jun 12, 2009 at 04:08 UTC | |
by AnomalousMonk (Archbishop) on Jun 12, 2009 at 15:48 UTC |