> -----Original Message-----
> From: Chas Owens [mailto:[EMAIL PROTECTED] 
> Sent: Monday, September 17, 2007 10:14
> To: W. Sp.
> Cc: beginners@perl.org
> Subject: Re: how to make use of $content in LWP
> 
> On 9/16/07, W. Sp. <[EMAIL PROTECTED]> wrote:
> snip
> > regex worked fine in my case. But my question was: how to 
> specifically sift
> > out a particular line number.
> snip
> 
> 
> There is a global variable named $. that stores the current line
> number.  So you can say things like
> 
> perl -ne 'print $. if /this is found/' file.txt
> 
> If you want to print a line that is on a given line number you can say
> 
> perl -ne 'print if $. = 400' file.txt

        $. == 400 and not $. = 400 ( assignment verses equality test ).
 Wags ;)

> 
> Or if you want to print a range of lines you can use the flip-flop
> operator (.. in scalar context)
> 
> perl -ne 'print if $. == 25 .. 50' file.txt
> 
> snip
> > Also, while using LWP modules, what type of
> > data is $content = get($url)? Is it an array? Is there a 
> way to find out
> > what kind of data a particular variable stores?
> snip
> 
> Scalars hold strings, numbers, or references
> Arrays hold multiple scalar values and allow indexing by position
> Hashes hold multiple scalar values and allow indexing by key
> 
> If a scalar holds a reference then the ref function will tell you what
> sort of reference it is (or its class if it is an object).
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
> 
> 
> 

**********************************************************************
This message contains information that is confidential and proprietary to FedEx 
Freight or its affiliates.  It is intended only for the recipient named and for 
the express  purpose(s) described therein.  Any other use is prohibited.
**********************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to