Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: "uhshifting" the diamond?

by pzbagel (Chaplain)
on Oct 21, 2003 at 00:46 UTC ( [id://300803]=note: print w/replies, xml ) Need Help??


in reply to "uhshifting" the diamond?

How about a do..while() so that the read happens at the end of the loop instead of the beginning:

#!/usr/bin/perl -w use strict; $_=<DATA>; (my ($first, $second), $_) = split(/\s+/, $_, 3); print "first: $first\n"; print "second: $second\n"; do{ print "rest: $_"; } while (<DATA>); __DATA__ This is line one! This is line two! This is line three! This is line four! This is line five!

Outputs:

first: This second: is rest: line one! rest: This is line two! rest: This is line three! rest: This is line four! rest: This is line five!

HTH

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-19 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found