Help for this page

Select Code to Download


  1. or download this
    chomp( my @lines = <$infile> );
    
  2. or download this
    use File::Slurp;
    my @lines = read_file( $infile, chomp => 1 );
    
  3. or download this
    my @lines = map { chomp; $_; $line_count++; } <$infile>;
    
  4. or download this
    my @lines = map { chomp; $_ } <$infile>;
    my $line_count = scalar @lines;