Help for this page

Select Code to Download


  1. or download this
    LINE:
    while (<>) {
      ...             # your program goes here
    }
    
  2. or download this
    LINE: while (defined($_ = <ARGV>)) {
        $first ||= $_;
    ...
        die "ERROR found $count lines. Need >5" unless $count > 5;
        print "FIRST:$first\nLAST:$last\n";
    }
    
  3. or download this
    perl -ne '$first ||=$_; $last=$_; $count++}{die qq(ERROR found $count 
    +lines. Need >5) unless $count>5; print qq(FIRST:$first\nLAST:$last\n)
    +' YOUR-FILE-NAME-here.txt