Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Trouble with a string

by kennethk (Abbot)
on Dec 11, 2012 at 23:16 UTC ( #1008423=note: print w/ replies, xml ) Need Help??


in reply to Trouble with a string

Assuming your post's whitespace has not been mangled (you should wrap output in <code> tags to avoid that), your issue is that the results from the external call ends with a newline character. This is easily fixed with chomp:

$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`; chomp(@VMSHUT); foreach $VMSHUT (@VMSHUT) { $VMFILE = $OLDVMDIR . $VMSHUT . $VMSFX; print "$VMFILE $NEWVMDIR \n"; }

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Trouble with a string
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008423]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2015-07-28 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls