Is there a way to iterate the other way around (from the start of the path to the end instead from the end to the start)?
Sure, Path::Class::Dir's components will give you the filename split into its components, like File::Spec's splitdir that I mentioned above. Note that I'm assuming you're talking about *NIX systems, where the two behave the same, I'm not sure at the moment how they behave in respect to volume names on Windows or other OSes.
Update: You've edited your node to add the following. Please see "It is uncool to update a node in a way that renders replies confusing or meaningless" in How do I change/delete my post? and mark your updates as such.
Also, does it know how to handle with multi-links? For example a/b -> c/d -> e/f? In case it's a link, should I iterate until I get the actual path?
You seem to be asking about readlink, which only reads the target of the link you're asking it to, it won't follow chains of links. You'll either have to do that manually, which is a little tricky (see e.g. my script relink), or if you just want to know the final target, use Cwd's abs_path.
In reply to Re^5: Creating a bash script "on the fly" (updated)
by haukex
in thread Creating a bash script "on the fly"
by ovedpo15
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |