Monks, Here's the situation. I have an array split by periods (.). If the first element contains the word /literal/ join the 1st and 2nd elements together. Allowing the original array to contain the two conjoined elements in the first indice. Here's what I got, but no dice!
UPDATE: I took kennethk's sugestions and Im currently testing out some modifications. Thanks Monks!!foreach my $results (@sorted) { + my @listOfItems = split( /\./, $results); if ( $listOfItems[0] =~ /literal/ ) { $listOfItems[0] = join(".", $listOfItems[0..1]); + } push ( my @array1, $listOfItems[0]); push ( my @array2, $listOfItems[1]); push ( my @array3, $listOfItems[2]); # @array1 should contain the newly conjoined $listOfItems[0] # My bad ! I had some typos in my sample code. It wasnt a # cut and paste from my terminal. So my mistake guys, sorry! # This is what I was actually working with. }
In reply to Joining Two Elements of an Array. Little Help Please. by ishootperls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |