Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Nested grouping or capturing inside capturing

by Not_a_Number (Prior)
on Nov 22, 2011 at 20:26 UTC ( #939539=note: print w/replies, xml ) Need Help??

in reply to Nested grouping or capturing inside capturing

What if "data with spaces" is not necessarily the third (or nth) field?

To make your code more robust, try Text::CSV:

use Text::CSV; my $csv = Text::CSV->new( { sep_char => ' '} ); my $fh = *DATA; # Replace *DATA with your input file name while ( my $row = $csv->getline( $fh ) ) { say join '-', @$row; } __DATA__ abc def data 123 ghi jkl "data with spaces" 456 "oh dear" "more data with spaces"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939539]
[usemodperl]: someone has yet to make that future famous free http to https proxy written in perl and supported by ads, paypal, patreon, etc to make millions of dollars a minute!
[Veltro]: Why would this be fresh, I recon this is stuff that happens all the time (not Perl per se)
[Corion]: usemodperl: I'm sure you could even code that on the command line.
[usemodperl]: definitely

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2018-06-24 17:03 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.