Eric on 17 Jan 2006 23:53:39 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Perl question...


I know there are perl hackers about... 

I have a file - a typical line might look like this:

1         1        1       Ownership                 FeeSimple          Fee Simple              

The desired data is the last field - indexed by the first three and forget the 
other two.  The "hitch", if you will, is that I'm using unpack to get the 
fields like this:

#!/usr/local/bin/perl
open EAT, "<Translation.txt" or die "bummer dude - no file?\n" ;
while (<EAT>) {
  ($f1, $f2, $f3, $junk, $junk2, $data) = unpack("a10, a9, a8, a26, a18, a35 ", $_) ;
  print $data ; 
}

Some, but not all, of the rows in this file use TABS to keep the columns
aligned.  That's all well and good but perl then grabs more characters
than I want it to thereby 'nipping' a random amount off the front of my data.
Is there a way to get perl to deal with the columns instead of the characters?


Thanks,
Eric
-- 
------------------------------------------------------------------------
#  Eric A Lucas
#  ------------
#   "Oh, I have slipped the surly bond of earth
#    and danced the skies on laughter-silvered wings... 
#        -- John Gillespie Magee Jr.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug