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

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/


Reply via email to