Perl_Programmer1992 has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; my @input = "1,2,3,4,5"; my $string = join ":" , @input; print "$string\n"; #output is "1,2,3,4,5" my $string2 = join ":" , 1,2,3,4,5; print "$string2"; #output is "1:2:3:4:5"
Hi monks , when I am printing $string , the output is same as printing the array @input , join is not working as expected when I am providing it an array as argument , but when I am printing $string2 the output is as expected from join function , please let me know where I am wrong.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Doubt in usage of join function
by Athanasius (Archbishop) on Jan 07, 2019 at 07:17 UTC | |
by Perl_Programmer1992 (Sexton) on Jan 07, 2019 at 07:22 UTC | |
|
Re: Doubt in usage of join function
by davido (Cardinal) on Jan 07, 2019 at 15:52 UTC |