Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Str extract the word between the first and the 2nd '|' character

by radiantmatrix (Parson)
on Apr 11, 2008 at 16:41 UTC ( [id://679755]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $string = '(<some word> | No Qualifier | <some word> | <some word>'
    +;
    my $start = index( $string, '|' );          # find first pipe position
    my $end = index( $string, '|', $start+1 );  # find next pipe position
    
    my $qualifier = substr( $string, $start, $end-$start+1 ); # extract
    
  2. or download this
    use IO::File;
    use Text::CSV_XS;
    ...
        my $row = $csv->getline($io);  # read and parse line into an ARRAY
    +ref
        print "Second field says: ", $row->[1], "\n";
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2025-03-25 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (67 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.