develooper Front page | perl.beginners | Postings from August 2009

Re: 'Join' query

Thread Previous | Thread Next
From:
John W. Krahn
Date:
August 7, 2009 08:27
Subject:
Re: 'Join' query
Message ID:
4A7C47BF.8010604@shaw.ca
jet speed wrote:
> Hi,

Hello,

> I would like to join the $abc with ':'  the final desired output 1:2:3:4:5
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> my $abc = "1 2 3 4 5";
> my $out = join ':', $abc;
> print "$out";
> 
> executing the above, i get the same output 1 2 3 4 5, not sure were am going
> wrong.
> 
> Any help on this would be much appreciated.

$ perl -le'
my $abc = "1 2 3 4 5";
print $abc;
$abc =~ tr/ /:/;
print $abc;
'
1 2 3 4 5
1:2:3:4:5



John
-- 
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About