Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Doubt in usage of join functionby Athanasius (Archbishop) |
on Jan 07, 2019 at 07:17 UTC ( [id://1228128]=note: print w/replies, xml ) | Need Help?? |
Hello Perl_Programmer1992, Your problem is not with the join function, but with the array assignment. The statement my @input = "1,2,3,4,5"; is not doing what you think it is. It is in fact assigning a single element to the @input array, namely the string "1,2,3,4,5". If you want instead to assign 5 separate elements to the array, you have two options:
Note: a module such as Data::Dumper or Data::Dump is useful to show you the actual contents of an array (or hash), so you can easily check that its contents are what you expect them to be. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|