Help for this page

Select Code to Download


  1. or download this
    my @data = `some_tool foo bar params 2> /dev/null | sort`;
  2. or download this
    my @data = sort `some_tool foo bar params 2> /dev/null`;
  3. or download this
    my $text = do {
        open my $fh => $file or die "open: $!\n";
        local $/;
        <$fh>;
    };
    
  4. or download this
    my $text = `cat $file`;
  5. or download this
    sub slurp_file($) {
        open my $fh, (my $file = shift) or die "open $file: $!\n";
        local $/;
        <$fh>;
    }