Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Finding first block of contiguous elements in an array

by dws (Chancellor)
on Dec 21, 2002 at 06:10 UTC ( #221580=note: print w/replies, xml ) Need Help??

in reply to Finding first block of contiguous elements in an array

Special bonus to anyone who can tell me what an agkistrodon acutus is, and how deadly is its bite.

That would be the Formosan Hundred-pace (or conehead) snake, whose bite causes skin and muscles to darken and deteriorate, accompanied by blistering and blood-tinted discharge and a slight burning sensation.

Assuming you've opened the file using the filehandle FILE, the following should work:

while ( <FILE> ) { last if /^TITLE (.*)$/; } $title = $1; while ( <FILE> ) { last if not /^TITLE (\d*) (.*)/; $title .= ' ' . $2; }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2020-05-31 07:56 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (173 votes). Check out past polls.