http://www.perlmonks.org?node_id=807960


in reply to Checking a path

Using substr like you have in your example probably is the most efficient way to go about this. Usually, though, this kind of micro-efficiency isn't something you need to worry about unless you've done profiling and you know that you have good reason to seek an improvement.

Replies are listed 'Best First'.
Re^2: Checking a path
by AnomalousMonk (Bishop) on Nov 18, 2009 at 17:46 UTC
    Note that for more concision the last character of the string can be obtained by:
    substr($TestStrings{$TestPatternKey}, -1)