in reply to How do I append an extension onto a variable name?
Generally, appending something to another variable uses the dot (.) operator.
How to do what you want depends upon where you are storing your original filenames. Assuming that you have them in an array named @files and you want to stuff them in an array names @perschecked:
# alternately, you may want to push them onto @perschecked for my $x ( 0 .. 2 ) { $perschecked[ $x ] = $files[ $x ] . ( $x + 1 ); }
If you want to append $x in place:
for my $x ( 0 .. 2 ) { $files[ $x ] .= ( $x + 1 ); }
Note that the $x + 1 is in there because the array index is one lower than the position of the element.
|
|---|