Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: how to make first element of an string as a the array nameby erroneousBollock (Curate) |
on Nov 15, 2007 at 00:13 UTC ( [id://650877]=note: print w/replies, xml ) | Need Help?? |
First you need to parse your file. What have you already tried? Can we see your code? (When you post your code, please remember to read the Writeup Formatting Tips.)
now i want to make each line as an array and give the first one as the name of thePlease don't use variables as variable names (yes this still applies).
Second, you'd do better to store your arrays as references in a hash, where the keys to the hash could be 'IL12::1::287', 'IL12::1::329', etc. As for the array "common elements" problem, the usual way to solve that is to build a hash containing the elements of the first array as keys, then to loop through the elements of the second array testing for existence in the hash.
-David
In Section
Seekers of Perl Wisdom
|
|