in reply to Splitting a word

Assuming all your data is in @array, then surely a regexp, along the lines of:
for ($i=0; $i<=$#array; $i++) { $array[$i] =~ s/\w{2}(\d{4})\w+/$1/; }
Would work?

Replies are listed 'Best First'.
RE: Re: Splitting a word
by Adam (Vicar) on Oct 05, 2000 at 20:04 UTC
    Or even:
    s/\w\w(\d{4})\w+$/$+/ for @array;
RE: Re: Splitting a word
by Anonymous Monk on Oct 05, 2000 at 19:56 UTC
    Amazing... 5 mins after i post there is the answer that works.. thanks a million. :)

    -Dipul Patel
      You may be interested in reading perlre for basic regular expression processing. Another poster also mentioned substr, which is a standard core Perl function.