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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Trouble with a string
by johngg (Canon) on Dec 11, 2012 at 23:14 UTC | |
by Anonymous Monk on Dec 11, 2012 at 23:21 UTC | |
Re: Trouble with a string
by kennethk (Abbot) on Dec 11, 2012 at 23:16 UTC | |
Re: Trouble with a string
by Anonymous Monk on Dec 11, 2012 at 22:42 UTC |
Back to
Seekers of Perl Wisdom