in reply to Re^3: Check last character of a string
in thread Check last character of a string
For the sake of a shorter program, one less function call, a negated regexp and completely ignoring the one-liner posted Corion very early in this thread
use strict; use warnings; my $location = "some location"; my $dirchar = "\\"; $location = $location.$dirchar if ($location !~ /{$dirchar}$/); print "Hier ist es : ".$location."\n";
I may have approached the problem the same way as you are when I first started learning Perl. Now I would tend to use the above. I don't find regexp's easy but perlrequick is a good starting point before moving on to doc::/perlre and Mastering Regular Expressions
|
|---|