Created
July 21, 2010 20:46
-
-
Save tene/485105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| multi sub do-stuff(Str $fn where { $fn.IO ~~ :f }) { | |
| say "file: $fn"; | |
| } | |
| multi sub do-stuff(Str $fn where { $fn.IO ~~ :d }) { | |
| say "dir: $fn"; | |
| } | |
| multi sub do-stuff(Str $fn where { $fn.IO !~~ :e }) { | |
| say "No such file: $fn"; | |
| } | |
| sub MAIN(Str $filename) { | |
| do-stuff($filename); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [sweeks@sweeks-laptop ~]$ perl6 /tmp/sig.pl | |
| Usage: | |
| /tmp/sig.pl filename | |
| [sweeks@sweeks-laptop ~]$ perl6 /tmp/sig.pl /etc/passwd | |
| file: /etc/passwd | |
| [sweeks@sweeks-laptop ~]$ perl6 /tmp/sig.pl /tmp | |
| dir: /tmp | |
| [sweeks@sweeks-laptop ~]$ perl6 /tmp/sig.pl /xlsqbq | |
| No such file: /xlsqbq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment