I should have tested before I posted :-)
The 'magic' can be useful but with caveats. The following snippet shows when it does work (the first three) and when it doesn't (the final three).
#!/usr/bin/perl use strict; use warnings; my @array = qw(a123 abc abc1 123a 123_1 abc_1); for my $element (@array){ print "before: $element\n"; $element++; print "after: $element\n"; print "\n"; } __DATA__ output (with comments) # these "do what you want" before: a123 after: a124 before: abc after: abd before: abc1 after: abc2 # and these don't :-( # if the string starts with a number # Perl treats it as number before: 123a after: 124 # the _ always breaks the magic before: 123_1 after: 124 # not at all sure what's happening here! before: abc_1 after: 1
In reply to Re^3: unique filename
by wfsp
in thread unique filename
by lax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |