file:
and the
current directory if there's no protocol specified.
#!/usr/local/bin/perl -w use Cwd; die("usage: open-url URL\n") if ($#ARGV != 0); $browser = exists $ENV{'BROWSWER'} ? $ENV{'BROWSWER'} : 'netscape'; $url = pop(@ARGV); if (not $url=~m/^(?:file|gopher|https?|mailto|news):/) {$url = 'file:' . ($url=~m|^/| ? $url : cwd."/$url")} (system($browser,@ARGV,'-remote',"openUrl($url)")>>8) and exec($browser,@ARGV,$url);
Soapbox: perl has oodles of very attractive features: unlimited length arrays and hashes; supports object oriented modules; protected namespaces; turbo studly regular expressions; system interface commands; taint security checking; simplified data types; and ... (time passes, people fall asleep) ... and on-the-fly compilation.