Hey everyone,

I am in a bit of a twist here since i am new to perl, Let me give you what the problem is first then following the problem I am pasting the script and output below.

Here is what I am trying to accomplish, I am parsing a directory which contains files, and getting some values and pushing those values in an array, Now this array contains duplicate values, which I get the count of each time a duplicate value has occured in the array, after that I remove the multiple values of an array so that my array doesn't have duplicate values.
Now for each value in the array I need to parse a file , find that element and grab another value say transport, which I am able to do ...BUT NOW THE TRICKY part for me is to display all that in the following output:

ELEMENT OF ARRAY |  NUMBER OF TIMES |  TRANSPORT

I can display the values like below

ELEMENT OF ARRAY | NUMBER OF TIMES

once that output is done then the other output which follows is below

ELEMENT OF ARRAY  |  TRANSPORT

can anyone help me out here .. please do note i am really new to perl

thanks

below is my script

#!/usr/bin/perl use Getopt::Long; &GetOptions('date=s' => \$date, 'dir=s' => \$directory, 'help' => \$help); if ( defined $help ) { usage(); } unless ( defined $date ) { usage(); } ####################################### # Declaring my variables below for # # the script # ####################################### my $PATH = "/Ack/$date/"; my $ID; my $TRANSPORT; my $ftpoutbound = "/homes/ftpoutbound.db"; my %count; my @id; my $temp; opendir (DIR, $PATH) || die print "can't open dir $PATH at line 62 : $ +!\n"; my @FileList = readdir(DIR); close (DIR); foreach $FileList(@FileList) { if ( ($FileList eq ".") || ($FileList eq "..") ) { next; } else { chomp $FileList; open (FILE, "$PATH$FileList") or die ("can't open $PATH$FileList + :$!\n"); @LINES=<FILE>; close FILE; foreach $LINES(@LINES) { @Fields = split (/[\|\*~]/, $LINES); if ( $Fields[5] =~ /^ZZ$/ ) { $ID = $Fields[6]; push (@id, $ID); } } } } $count{$_}++ for @id; print "$_ => $count{$_}\n" for keys %count; %temp = (); @id = grep ++$temp{$_} < 2, @id; open (File, "$ftpoutbound") or die ("can't open $ftpoutbound at line * +* : $!\n"); @FTP_Lines=<File>; close File; foreach $id(@id) { $id =~ s/\s+//; foreach $FTP_Lines(@FTP_Lines) { chomp $FTP_Lines; @FTP_fields = split (/\;/, $FTP_Lines); if ( $FTP_fields[0] eq $Clec_id ) { $TRANSPORT = $FTP_fields[7]; #print "C => $id and TRANSPORT => $TRANSPORT\n"; } } print ("$id uses $TRANSPORT as transport\n"); } # help/usage message and exits sub usage { print "Usage: \n"; print "This program requires one argument, w/ an optional help argum +ent.\n"; print "Options should be specified as follows: \n"; print "--date REQURIED Takes in the mmddyyyy format on +ly\n"; print "--help OPTIONAL Prints this message.\n"; print "example: ./TransactionsPerDay.pl --date 09152003 \n"; exit(1); }

below is the output
RHYTHMSIAVZSP => 117 ALGXSOULSOG5 => 1 SPNTVRZPRD => 69 2037721000SORD => 1 NEXTXOVENORDIAP => 5 VZEAPIPO => 27 VZELFLPO => 2 SGWEASTPROD => 41 TALKLSOG5 => 406 VZAPRODBAN => 21 gntftp5p => 98 NVEECIPO => 3 NVEDLCPO => 15 NVEIGCPO => 6 VZAPRODBAS => 24 VORDBAN2 => 234 VORDBAN2 uses SSL as transport COVADVZESORDP uses yes as transport ASHEESH uses yes as transport VORDBAS2 uses SSL as transport CMSTVZEORDP uses SSL as transport RHYTHMSIAVZSP uses SSL as transport TALKLSOG5 uses SSL as transport COVADVZENORDP uses yes as transport DSLNETBANORD uses yes as transport
Below is the desired output I want
RHYTHMSIAVZSP 12 SSL COVADVZ 245 yes ATT 33 NDM
I hope I have provided all the information

thanks

BazB edit, reformat/fix code tags. Add readmore.


In reply to Help on displaying the output of two arrays by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.