On Aug 17, 2012, at 10:07 AM, jet speed wrote:

> Chaps,
> 
> Thanks for all your comments, I am strill trying to resolve my inital
> query. Any help would be much appreciated.
> 
> 
> I have the below program. i can match the entries in actzone.txt file in
> bluealias.txt and print it.
> 
> what i would like to achive is to print the alias name and the reated wwn
> for each zone that matched in 2 formats in different file ex. as below.
> Please could you help me achieve this.

I too think you need to format both files before you compare them. Then split 
the two strings into arrays, then compare the two arrays to see what matches. I 
think this is the code you need to compare the two arrays with (from perlfaq4:

        •     my (@union, @intersection, @difference);
        •     my %count = ();
        •     foreach my $element (@array1, @array2) { $count{$element}++ }
        •     foreach my $element (keys %count) {
        •         push @union, $element;
        •         push @{ $count{$element} > 1 ? \@intersection : \@difference 
}, $element;
        •     }

As to the formatting, a series of substitutions on the string of characters in 
those files should get you to where you can split the strings and store the 
contents in your arrays, so keep working on the formatting and run it through 
the above until you get it working.

I hope this helps..

Bill



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to