Hi Sj, On Wed, 5 Sep 2012 14:33:13 +0100 jet speed <speedj...@googlemail.com> wrote:
> Hi All, > > i have an regx question. i have the array contents, now i want to > remove the first 2 characters (fc) of each element in the array and > store it in a second array ex: @array2 > > @array ="fc20/1, fc30/22, fc40/3, fc20/1"; > > output > > @array2 ="20/1, 30/22, 40/3, 20/1"; > You are using invalid syntax for arrays again. This is getting annoying. In any case, either of those should do the trick: my @new = (map { substr($_, 2) } @old); Or: my @new = (map { s/\A..//r } @old); # If your perl is recent enough. If your Perl is too old you can do: my @new = (map { my $x = $_; $x =~ s/\A..//; $x; } @old); > please advice. > > Thanks > Sj Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Optimising Code for Speed - http://shlom.in/optimise The X in XSLT stands for eXtermination. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/