Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: parsing a space-separated filename in a line with fields separated by spaces

by mamawe (Sexton)
on Aug 15, 2007 at 22:28 UTC ( [id://632871]=note: print w/replies, xml ) Need Help??


in reply to parsing a space-separated filename in a line with fields separated by spaces

Would you mind using a regex?
while (<>) { if (/^(\w{3} \w{3} [ :\d]{16}) (\d+) ([.\d]+) (\d+) (.+) ([a]) ([_ +]) ([o]) ([r]) (\w+) (\w+) (\d) (\S) ([c])$/) { print "$1 $2 $3 $4 '$5' $6 $7 $8 $9 $10 $11 $12 $13 $14\n"; } }
puts nice single quotes around the name and you can access every field as well. You might even assign it to a list of variables.
  • Comment on Re: parsing a space-separated filename in a line with fields separated by spaces
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://632871]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found