develooper Front page | perl.beginners | Postings from April 2008

perl head and tail command ?

Thread Next
From:
Richard Lee
Date:
April 28, 2008 10:31
Subject:
perl head and tail command ?
I would imagine linux's head command can be replaced w/ chop
I asked this because I have a filehandle which was,

open $source, '/tmp/server.txt'   ( and no doing head -1 /tmp/server.txt 
is not an option since I need to go through some other stuff
before i need to issue below command )

and I wanted to do

my $top = `head -1 $source`
my $bottom = `tail -1 $source`

but I realized I cannot do $source in back tick.

so I imagine i can do

my $top = chop $source;

But what about the $bottom one?

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About