in reply to Re^4: Possible bug with array pointer
in thread Possible bug with array pointer
Hi jockel,
If you've got Perl v5.14 or later, note that there's also s///r:
use 5.014; my $sampleids = ['A','_B','C']; my @temp_SAMPLEIDS; foreach my $var (@$sampleids) { push(@temp_SAMPLEIDS, $var =~ s/_//gr); } # OR my @temp2_SAMPLEIDS = map {s/_//gr} @$sampleids; use Data::Dumper; print Dumper($sampleids, \@temp_SAMPLEIDS, \@temp2_SAMPLEIDS); __END__ $VAR1 = [ 'A', '_B', 'C' ]; $VAR2 = [ 'A', 'B', 'C' ]; $VAR3 = [ 'A', 'B', 'C' ];
Hope this helps,
-- Hauke D
|
|---|