http://www.perlmonks.org?node_id=1008416

johnnywhall has asked for the wisdom of the Perl Monks concerning the following question:

Hello All, I'm trying to create a string to ultimately copy a file from one location to the other, but when i try to append a common string to the end of the file I'm not getting the results that I expect. Each file suffix is -vda.img with the prefix all completely random. Here is what I have so far..

$OLDVMDIR = "/sunstorage_kvm_images/kvm_images/images"; #Current Dire +ctory $NEWVMDIR = "/sunstorage_kvm_images/kvm_images/images_new"; #Target ( +New) Directory $VMSFX = "\-vda\.img"; #File suffix for each file <snip> @VMSHUT = `cat /tmp/virshlist_shutdown`; foreach $VMSHUT (@VMSHUT) { $VMFILE = $OLDVMDIR . $VMSHUT . $VMSFX; print "$VMFILE $NEWVMDIR \n"; }

What I'm expecting is it to print something like this..

/sunstorage_kvm_images/kvm_images/images/Debian-vda.img /sunstorage_kvm_images/kvm_images/images_new

Instead I'm getting..

/sunstorage_kvm_images/kvm_images/imagesDebian

-vda.img /sunstorage_kvm_images/kvm_images/images_new

TIA