perlnoobster has asked for the wisdom of the Perl Monks concerning the following question:
in the phones.txt file there is a list of phones such as:my $output = "phones_out.txt"; open(OUT,"+>$output"); my $PHONE_FILE = $ARGV[0] || 'phones.txt'; my @COLOURS = <DATA>; my $GET_MODEL = qr{\A ( [^\n]+ ) }x; open my $PHONES, '<', $PHONE_FILE or die "Cannot open $PHONE_FILE\n"; Case Cover"; while (my ($phn) = <$PHONES> =~ $GET_MODEL) { Do something (matches phone models to colours) }
etc And the code runs perfectly fine, the colours in the __DATA__ section asign perfectly with the phone models. with all the above in mind I need help in regards to adding a second column into the phones.txt file, i added a column with values (seperated by tab) into the text file however that is also getting printed in the output file aswell as the first column? I want to differentiate between the columns at the beginning of the loop, is this possible? (so that i can call upon the variable at a later stage e.g $results[0] = phone model (column 1) $results1 = phone style (column 2) I hope this makes sense? please can someone help me? Thank you :)iphone samsung s2 motoroalla atrix
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Separate column results?!
by choroba (Cardinal) on Aug 29, 2012 at 07:50 UTC | |
by perlnoobster (Sexton) on Aug 29, 2012 at 09:27 UTC | |
by perlnoobster (Sexton) on Aug 29, 2012 at 09:33 UTC | |
by perlnoobster (Sexton) on Aug 29, 2012 at 09:36 UTC | |
by philiprbrenan (Monk) on Aug 29, 2012 at 10:09 UTC | |
|
Re: Separate column results?!
by pvaldes (Chaplain) on Aug 29, 2012 at 17:28 UTC |