Hi,
Now I've actually worked out how to acheive what I want, I'm just curious why it has to be done this way, so clarification is appreciated.
I have an array which stores the months of the year, I wan't to generate a tabular report and so wanted to use join to build the table columns easily...
The solution i found was this...
why do you have to map it and use join in this manner, why isn't it as simple as...
To me the above seems more logical, but I guess I'm missing something as it doesn't work and I have to use the alternative I've shown.
I thought map was for generating hashes from arrays, so I'm a little confused why the string has to start the way it does and why map has to be used.
I simply want it to go through the array concatenating $_ with the string, only it doesn't seem to be that simple.
So I'd appreciated anyone's input as to what is actually going on.
Thanks,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts
Now I've actually worked out how to acheive what I want, I'm just curious why it has to be done this way, so clarification is appreciated.
I have an array which stores the months of the year, I wan't to generate a tabular report and so wanted to use join to build the table columns easily...
The solution i found was this...
Code:
$tab .= '<td class="titlecell">' . join('<td class="titlecell">',map{$_ . '</td>'}@mnames );
why do you have to map it and use join in this manner, why isn't it as simple as...
Code:
$tab .= join('<td class="titlecell">' . $_ . '</td>',@mnames);
To me the above seems more logical, but I guess I'm missing something as it doesn't work and I have to use the alternative I've shown.
I thought map was for generating hashes from arrays, so I'm a little confused why the string has to start the way it does and why map has to be used.
I simply want it to go through the array concatenating $_ with the string, only it doesn't seem to be that simple.
So I'd appreciated anyone's input as to what is actually going on.
Thanks,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts