Help for this page

Select Code to Download


  1. or download this
    BEGIN { require Foo; Foo->import(@LIST) }
    
  2. or download this
    while (<>) {
         # ... your code here ...
         print $_;
    }
    
  3. or download this
    perl -p -e "$_ = reverse $_" f1
    
  4. or download this
    print -p -e "$_ = reverse $_; $i ++; END { print qq'Total lines $i.' }
    +" f1
    
  5. or download this
    $a = 6;
    *b = \ $a;
    ...
    *b = \ @a;
    pop @b;
    print "@a"; # prints 1 2
    
  6. or download this
    use Shell;
    
    $a = Shell::cat("file.text");
    Shell::cp("a.txt", "b.txt");
    
  7. or download this
    package Shell;
    
    ...
    sub cp {
         `cp @_`
    }
    
  8. or download this
    package Shell;
    
    ...
         $AUTOLOAD =~ s/^.*:://; # Strip out the package name from the sub
    +'s name (in this case Shell::)
         `$AUTOLOAD @_`
    }