in reply to Unix 'head' in perl

Adjust as required.

perl -ple" exit if $. == 20" file

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Replies are listed 'Best First'.
Re: Re: Unix 'head' in perl
by edan (Curate) on May 14, 2003 at 14:09 UTC
    which only prints 19 lines of the file...
    --
    3dan

      Good point!

      perl -ple"exit if $. > 20"

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
        I am getting compilation error, what i have used is $file_next = perl -ple" exit if $. == 10" $file_upload; where my $file_upload="$dir_details->{WORK_DIR}/upload/$params->{upname}.dat"; is the syntax correct?