A quick and dirty solution might be really to use something like my @path = split m:/:, "/home/temp/login"; Disadvantage of such a solution is that your code will break if a dirname contains a slash or you start working on Windows.
Actually, / is not allowed in directory or file names. Windows disallows both \ and /
FYI, Windows accepts both \ and / as separators:
perl -e "print $ARGV[0] . ':';open(FH,$ARGV[0]) or die $ARGV[0] . ':' . $!;" dir/file.txtIn reply to Re^2: How to split "/"
by RonW
in thread How to split "/"
by Jaycob777
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |