Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Regular Expressions question

by roboticus (Chancellor)
on Oct 29, 2012 at 19:05 UTC ( #1001405=note: print w/ replies, xml ) Need Help??


in reply to Regular Expressions question

CJXJ220:

It looks like you're using join incorrectly in your data collection loop. The join function uses the first item in its argument list as a separator which is placed between all the other items in the list. It looks like you're using it as a concatenator, which it will fail miserably at (at least the way you use it).

For example: print join('a','b') will print the letter b on your console, and print join('a','b','c') will print "bac". Normally, you'd use it like print join(", ", 'a', 'b','c') to get a nicely formatted list: "a, b, c".

So you can change:

$T1List = join ($T1List,$interface,"\n");

to

$T1List = $T1List . $interface . "\n";

or you can build an array to hold your interfaces, and join them at the end.

Update: Fixed example (to "bac") ... thanks for the catch johngg!

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Regular Expressions question
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2015-07-07 07:21 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 (87 votes), past polls