Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Trouble with a string

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


in reply to Trouble with a string

@VMSHUT = `cat /tmp/virshlist_shutdown`;

You will also need to remove the line terminator from each line of the array using chomp otherwise each file name will have a spurious line terminator at the end.

$ cat zzz Line 1 Line 2 Line 3 $ perl -e ' > @lines = `cat zzz`; > print qq{>$_<\n} for @lines;' >Line 1 < >Line 2 < >Line 3 < $ perl -e ' > @lines = `cat zzz`; > chomp @lines; > print qq{>$_<\n} for @lines;' >Line 1< >Line 2< >Line 3< $

I hope this is helpful.

Cheers,

JohnGG


Comment on Re: Trouble with a string
Select or Download Code
Re^2: Trouble with a string
by Anonymous Monk on Dec 11, 2012 at 23:21 UTC

    Thanks, I think it's the chomp. It's always the simple things.. And it doesn't help that I'm 10 years rusty and not the good with PERL to begin with. :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-03 06:44 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 (48 votes), past polls