Help for this page

Select Code to Download


  1. or download this
    open(FILE, '<', 'sample.txt') or die "Could not open 'sample.txt' for 
    +input: $!\n";
    print scalar(<FILE>);   # print ONE LINE from the file
    ...
    $line1 = <FILE>; # get ONE LINE from the file
    close FILE;
    print $line1;