I don't see why hippo's second second suggestion above (the OTOH one) would not cover all your cases:
c:\@Work\Perl\monks>perl -wMstrict -le
"for my $path (
'scp', 'sss40s1u01:/home/example/test.txt', '/home/example/testdir'
+,
@ARGV,
) {
print qq{'$path' matches} if $path =~ /^\//;
}
" "/any" "/other/examples"
'/home/example/testdir' matches
'/any' matches
'/other/examples' matches
(BTW: My own preference for the regex expression would be m{ \A / }xms rather than /^\//)
Give a man a fish: <%-(-(-(-<
|