PERL: Strange outcome of variable value manipulation
I only dip my toe into PERL programming on the odd ocassion so I was wondering if anyone had any ideas as to why the below is happening:
When I run my PERL script the variable values seem to get mixed up.
my $fileName = basename($maxFile,".TXT");
my $currentSeqNum = substr($fileName,-1,1);
my $nextSeqNum = ($currentSeqNum)++;
print "File Name: $fileName\n\n";
print "Current Sequence Num: $currentSeqNum\n\n";
print "Next Sequence Num: $nextSeqNum\n\n";
$maxFile gets it value from an sql query using DBI which is correct. The problem lies in the fact that the "Current Sequence Num:" and "Next Sequence Num:" values seem to be the wrong way round.
File Name: FOT05172
Current Sequence Num: 3
Next Sequence Num: 2
Can anyone spot a mistake in my code?