in reply to substr on $_

Here is one way:
use strict; # look ma! no $_! ;) while (<DATA>) { s/\d\d(\d\d)\.(\d+)/$1$2/; print; } __DATA__ 1996.40637 1996.41064 1996.41199 1996.41467 1996.41882

UPDATE: ack! i see it now: you want =~, not = for your substitution lines.

Here is my above while loop with the implicit $_:

while ($_ = <DATA>) { $_ =~ s/\d\d(\d\d)\.(\d+)/$1$2/; print $_; }

UPDATE 2: re japhy
DOH! ;)

jeffa

Replies are listed 'Best First'.
Re: (jeffa) Re: substr on $_
by gisrob (Novice) on Sep 28, 2001 at 00:47 UTC
    Cool - thanks.