For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2008 > while and last









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author while and last
Kevin Viel

2008-01-15, 7:02 pm

Hello,

If I only want the data on the first line of a file, can I use "last" to
exit the loop or should I consider another tool?

Thank you,

Kevin

Kevin Viel, PhD
Post-doctoral fellow
Department of Genetics
Southwest Foundation for Biomedical Research
San Antonio, TX 78227

John W. Krahn

2008-01-15, 7:02 pm

Kevin Viel wrote:
> Hello,


Hello,

> If I only want the data on the first line of a file, can I use "last" to
> exit the loop or should I consider another tool?


Don't use a loop at all:

my $data = <FILE>; # Grap one line from file


John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
Kevin Viel

2008-01-16, 4:02 am

> -----Original Message-----
> From: John W. Krahn [mailto:krahnj@telus.net]
> Sent: Tuesday, January 15, 2008 1:39 PM
> To: Perl Beginners
> Subject: Re: while and last


> my $data = <FILE>; # Grap one line from file


Doh!

Thanks :)


Kevin Viel, PhD
Post-doctoral fellow
Department of Genetics
Southwest Foundation for Biomedical Research
San Antonio, TX 78227

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com