Help for this page

Select Code to Download


  1. or download this
       while (defined(my $line = <$in>)) {
            chomp $line;  # Zap trailing "\n" efficiently 
            print $out $line,"\r";
        }
    
  2. or download this
    #!/usr/bin/perl
    
    ...
        print "read: $line\n";
    }
    close $in;
    
  3. or download this
    >perl foo.pl
    read: a line
    read: a second line
    read: 0
    >
    
  4. or download this
    >perl -E '"0\n" and say "true"'
    true
    ...
    >perl -E 'undef or say "false"'
    false
    >