ok, let's say you have a file where each line looks like this:

--a--       430 Fri Mar 19 18:32:47 1999 D:\Program Files\Common
Files\Adobe\Web\AwePrefs.txt

and you want to get the filename (and every other field) out of it, the obvious
thing to split on is whitespace (\s+) which give something like the following:

my ( $attribs, $size, $day, $mon, $date, $time, $year, $file ) = split(/\s+/,
$line);

but of course that fails when files contain spaces, as in the above line.

Later on I'm trying to get JUST the filename out of the line and using:

($file = (split( /\s+/, $line ))[7]) =~ s/\*//g;

that little sub at the end strips '*' off the ends of filenames, again this
works great as long as there are no spaces in the filename/folders

Can anyone think up a slick way to extract the full filename from the above
line, in all cases?  the file cannot be reformatted (ie. I cannot change the
'bad' spaces into '|' or something else)  My first thought was to split to an
array, shift out the first 7 values, then shift the rest into the file variable
concatenating tham as I went, but that seems un-perlish to me, anyone have a
better way?

Chuck



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to