awohld has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use Data::Dumper; my @aoa; push @aoa, [ "null", "44", "4" ]; push @aoa, [ "6", "24", "6" ]; my $array = \@aoa; # show my data structure print Dumper $array; my $test = "xray"; # change first list element to variable "$test" if it isn't a number. @array = map { $_->[0] =~ s/[0-9]*/$test/ } @$array ; print Dumper \@array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: AoA Selective Element Substitution
by johngg (Canon) on Jul 20, 2007 at 22:25 UTC | |
|
Re: AoA Selective Element Substitution
by FunkyMonk (Bishop) on Jul 20, 2007 at 21:35 UTC | |
|
Re: AoA Selective Element Substitution
by shigetsu (Hermit) on Jul 20, 2007 at 22:48 UTC |