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

Re^5: Split array and join with results

by BillKSmith (Vicar)
on Aug 23, 2012 at 17:42 UTC ( #989359=note: print w/replies, xml ) Need Help??

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

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

  • Comment on Re^5: Split array and join with results

Replies are listed 'Best First'.
Re^6: Split array and join with results
by perlnoobster (Sexton) on Aug 24, 2012 at 07:53 UTC
    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>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989359]
Jar. Jar!...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-11-21 05:03 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (295 votes). Check out past polls.