perladdict has asked for the wisdom of the Perl Monks concerning the following question:
Code I am trying to append the filename to the Path as belowText file</br> #AAA45S49.${datestamp}.${timestamp}.txt #BBB75SWI.${datestamp}.${timestamp}.txt #YYYYYY.${datestamp}.${timestamp}.txt #XXXXXXX.${datestamp}.${timestamp}.txt #CCCCCCC.${datestamp}.${timestamp}.txt #DDDDDDD.${datestamp}.${timestamp}.txt #EEEEEEE.${datestamp}.${timestamp}.txt #FFFFFFF.${datestamp}.${timestamp}.txt #FFFFFF2.${datestamp}.${timestamp}.txt #GGGGGGG.${datestamp}.${timestamp}.txt #HHHHHHH.${datestamp}.${timestamp}.txt #IIIIIII.${datestamp}.${timestamp}.txt #JJJJJJJ.${datestamp}.${timestamp}.txt
Once after succeeding the concatination i need to verify the each file which is existed in "/efsprod/docmnt", if exist i need to copy the file from source "/efsprod/docmnt" to destination directory as current directory from where i am running the script(i.e /tmp/xxx/). The above code just printing the filenames which has been red from the text file and at the end of the o/p displaying as /efsprod/docmnt/0#!/usr/bin/perl @array = &report(); foreach $file(@array) { $path = "/efsprod/docmnt/"; $file = "$path" . "$file"; print "$file"; } sub report() { open(F,"Textfile.txt") or die "$!\n"; while(chomp($line=<F>)) { $line=substr($line,0,9)l $line= reverse($line); chop $line; $line=reverse($line); print "$line\n"; }
The o/p i am expecting as $file = /test/var/XXX001 /test/var/...... /test/var/XXX01B #but i am getting o/p as XX001BC YY001BC ...... ...... /test/var/0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unable to concatenate a Path to the array elements, which will have the values as return values from subroutine
by Athanasius (Archbishop) on Feb 24, 2014 at 15:51 UTC | |
|
Re: Unable to concatinate a Path to the array elements, which will have the values as return values from sunroutine
by GotToBTru (Prior) on Feb 24, 2014 at 16:01 UTC | |
|
Re: Unable to concatinate a Path to the array elements, which will have the values as return values from sunroutine
by hazylife (Monk) on Feb 24, 2014 at 15:25 UTC |