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