Some very discursive comments after a very brief inspection...

my @resilt = (); while (<fh>) { my @a = (); @a = &get_data_path_report ($_); my %seen = (); push (@result, @a); @result = grep { !$seen{$_}++ } @result; } shift(@result);

You seem to have used lexicals pretty consistently, but then undermined their use by not enabling strictures — and warnings for good measure. See warnings and strict. Add these two lines at the very start of your program
    use warnings;
    use strict;
and then fix all the errors and warnings.

push (@result, @a); @result = grep { !$seen{$_}++ } @result;

The push statement is redundant. The statement
    @result = grep { !$seen{$_}++ } @a;
would have the same effect, and a further simplification would be to use List::MoreUtils::uniq as in
    @result = uniq get_data_path_report();
alone, all other statements in the while-loop being needless.The statement
    use List::MoreUtils qw(uniq);
must be added at the start of the script to import uniq. (The function  get_data_path_report() does not need to have  $_ passed to it because the function takes no arguments — as far as I can see by quick inspection.)

The function

sub get_first_elements_of_string { my @a = (split (' ' ,"$_[0]")); return $a[0]; }
could be re-written (untested)
sub get_first_elements_of_string { my ($first) = split ' ', $_[0], 2; return $first; }
(see split for the LIMIT parameter) which will not change its effect, but may improve its performance.

Updates:

  1. Also WRT the  while (<fh>) { ... } loop: As it stands in the OP, this loop reads and processes the entire file, but then only keeps the final record read for further processing. Is this what you intended? Did you perhaps intend something like
        push @result, uniq get_data_path_report();
    instead?


In reply to Re: How to manage a big file by AnomalousMonk
in thread How to manage a pattern matching & counting with big data file by taj_ritesh

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.