Hi Perl monks, i'm a noob to perl and need assistance with the following dilemma, I have a list of words being read from a text file and I have an array of colours that I wish to assign to each word. The text file contains the following: iphone 3 iphone 3gs iphone 4 the array contains colours such as red blue green all i require is an output file showing the following: iphone 3 red iphone 3 blue iphone 3 green iphone 3gs red iphone 3gs blue iphone 3gs green iphone 4 red iphone 4 blue iphone 4 green
here's the coding for the array so far:Please can someone help me? Thank you :){ no warnings 'uninitialized'; chomp $results; push (@oid,$results[0]); $_ = defined($_) ? $_ : '' for @results; print "\n$results"; my $colour=(); my @colours=(); @colours = ( "baby blue", "baby pink", "black", "dark blue", "brown", + "dark purple", "green", "orange", "hot pink", "light purple", "red", + "white", "yellow"); foreach $colour (@colours) { print $colour; } print OUT "$results$colour\n" }
In reply to Split array and join with results by perlnoobster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |