Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Split array and join with results

by perlnoobster (Sexton)
on Aug 23, 2012 at 10:51 UTC ( #989274=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Split array and join with results
in thread Split array and join with results

on further inspection it seem as though its the $colr value in the print out function that seems to be inserting the line break?  print OUT "\n$phn $colr $title\n"; Please can someone help me?


Comment on Re^4: Split array and join with results
Download Code
Re^5: Split array and join with results
by BillKSmith (Deacon) on Aug 23, 2012 at 17:42 UTC

    $colr gets its value (including the newline) from @colours. If you prefer, you can chomp (refer perldoc -f chomp) $colr before you print it.

    Bill
      Hi Bill, Thank you so much for helping me, I really appreciate it! I've added the chomp function however i get the following error in secureCRT Modification of a read-only value attempted?? I think i've done it correctly:
      foreach my $colr (@COLOURS) { chomp $colr; print OUT "\n$phn $colr $title\n"; }
      How can i fix this? where do i place the chomp function? Thank you :)

        I expected that to work. I forgot that $colr is really an alias for an element of @COLOURS. I cannot think of a perfect fix. For now, remove Readonly from @COLOURS (remember to change the fat comma to an equal.)

        <c> my @COLOURS = <DATA>; <c>
        Bill

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2015-07-01 21:55 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 (22 votes), past polls