Ya I understand my problem now. But I solved this problem earlier in a way.

foreach my $Postpaid_file (@Postpaid_files) { open (POST ,"$Postpaid_file") or print "cannot open file\n +"; while(my $cdr_post_line = <POST>) { chomp $cdr_post_line; my @cdr_post_array = split(/\|/,$cdr_post_line); if ($cdr_post_array[12] eq "GSM" && $cdr_post_array[9] + eq "Submit") { $cdr_post_MO_cnt++ if any { /^\Q$cdr_post_arra +y[11]\E$/ } @MOresp_error; $Total_GSM_attempts++ unless any { /^\Q$cdr_po +st_array[11]\E$/ } @MOresp_error; } if ($cdr_post_array[12] eq "SMPP" && $cdr_post_array[9 +] eq "Submit" && $cdr_post_array[10] eq "0") { $cdr_post_AO_cnt++; #if any { /^\Q$cdr_post_ +array[11]\E$/ } @MOresp_error; $total_AO_success++ unless any { /^\Q$cdr_post +_array[11]\E$/ } @MOresp_error; $Total_SMPP_attempts++ unless any { /^\Q$cdr_p +ost_array[11]\E$/ } @MOresp_error; } if ($cdr_post_array[12] eq "GSM" && ($cdr_post_array[1 +3] eq "GSM" || $cdr_post_array[13] eq "ESMEGW") && $cdr_post_array[9] + eq "Submit") { $total_MT_P2P++ unless any { /^\Q$cdr_post_arr +ay[11]\E$/ } @MOresp_error; } if ($cdr_post_array[12] eq "GSM" && ($cdr_post_array[1 +3] eq "GSM" || $cdr_post_array[13] eq "ESMEGW") && $cdr_post_array[9] + eq "Submit" && $cdr_post_array[7] eq "Delivered") { $total_MT_P2P_success++; }

I thought we can do a better code (by not using all if's to check the conditions) using modules. Almost here also we are doing same. Then what's the benefit using this module. Or is there any other way to simpler my code(above mentioned)????

Update

The main reason to simplify my code is its become 624 lines which contains mostly if's(nearly one if for every four lines) and to check "eq && eq && eq". Its bulky, error prone & (important one) I dont like this :-)


In reply to Re^4: Need help with Text::CSV by ravi45722
in thread Need help with Text::CSV by ravi45722

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.