or download this
## AND IF YOU WANNA CHECK FOR A VALID URL, YOU REALLY NEED A MODULE (U
+RL::URI)
## BUT substr and rindex are still the best for the job
my $url = 'proto://domain.something/dir/file.extension';
my $protocol = substr $url, 0, index($url, '://'),'';
## yada yada yada, you get the point