Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Extracting selected fields form file record

by kcott (Archbishop)
on Feb 06, 2022 at 18:04 UTC ( [id://11141172]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -Mstrict -Mwarnings -e '(a,b,c,d,e,f) = [line.split()[i] for i 
    +in (0,1,3,5,7,9)]'
    Bareword "line" not allowed while "strict subs" in use at -e line 1.
    syntax error at -e line 1, near ")["
    Execution of -e aborted due to compilation errors.
    
  2. or download this
    $ perl -E '$_ = " a0 a1 a2 \n"; my ($x, @y) = split; say "|$x|@y|";'
    |a0|a1 a2|
    ...
    
    $ perl -E '$_ = " a0 a1 a2 \n"; my ($x, @y) = split /\s+/; say "|$x|@y
    +|";'
    ||a0 a1 a2|
    
  3. or download this
    my @wanted = (extraction_function($string))[0, 1, 3];
    my ($f1, $f2, undef, $f3) = extraction_function($string);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 06:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found