I have a perl script which uses 2 inputs file of size 16gb & 800mb and creates an output file. It creates 4 hashes to store data from 800mb file and then compare and retrieve data from the other 16gb file and finally creates a report Now its working pretty fine but it is getting stuck at random creating the final report of around 500mb. No Idea why it is getting stuck. It doesn't seem a script bug as the 500mb data of report is generating perfectly. Please help me..not pasting the code here as it is too big to put...please let me know if you need further info. Thanks

:) sorry for the trouble..I am pasting my code here...please help.

#!/usr/bin/perl use Data::Dumper; my $lookup; $lookup; ##Maharashtra to MH & Mumbai to MUM open(FH,"<",$ARGV[0]); open(AH,"<",$ARGV[1]); open(OUT,">",$ARGV[2]); open(LOG,">",$ARGV[3]); my $SubsSize= -s $ARGV[0]; my $AccuSize= -s $ARGV[1]; my $SubsCount=0; my $AccuCount=0; my $finalCount=0; my $AccUsg; my $AccUsg1; my $AccUsg2; my $AccUsg3; while(<AH>) { chomp; my $line=$_; $AccuCount++; my $MobileNumber; if( $line =~ /subscriberId:(\w+)\(\"(\d+)\"\)/ ) { $MobileNumber=$2; } my $plan=$line; $plan =~s/\\//g; my @AccVolume; if ( $plan =~ /usageControlAccum:(\w+)\(\"(.*)\"\)/ ) { my $p=$2; $p=~s/:\{/ => {/g; $p=~s/:\[/ => [/g; $p=~s/\"/\'/g; $p=~s/\':/\'=>/g; $p=~s/\}n/\}/g; #print $p,"\n"; my $e=eval($p); if ( @$ ) { push (@AccVolume,"error"); } else { foreach my $value ( @{$e->{'reportingGroups'}} ) { if ( exists ( $value->{'absoluteAccumulated'}->{'counters' +} ) ) { $AccUsg->{$MobileNumber}->{$value->{'subscriberGroupName +'}}=$value->{'absoluteAccumulated'}->{'counters'}->[0]->{'bidirVolume +'}; $AccUsg1->{$MobileNumber}->{$value->{'subscriberGroupNam +e'}}=$value->{'absoluteAccumulated'}->{'counters'}->[0]->{'name'}; $AccUsg2->{$MobileNumber}->{$value->{'subscriberGroupName +'}}=$value->{'absoluteAccumulated'}->{'expiryDate'}->{'volume'}; $AccUsg3->{$MobileNumber}->{$value->{'subscriberGroupNam +e'}}->{'time'}=$value->{'absoluteAccumulated'}->{'previousExpiryDate' +}->{'time'}; $AccUsg3->{$MobileNumber}->{$value->{'subscriberGroupNam +e'}}->{'volume'}=$value->{'absoluteAccumulated'}->{'previousExpiryDat +e'}->{'volume'}; } elsif ( exists ( $value->{'absoluteAccumulated'}->{ +'bidirVolume'} ) ) { $AccUsg->{$MobileNumber}->{$value->{'subscriberGroupName +'}}=$value->{'absoluteAccumulated'}->{'bidirVolume'}; } } } } } close(AH); print OUT "MSISDN,IMEI,Circle,DeviceType,OPTIN,PlanType,counterName,ex +pdate,prevTime,prevVol,PACKID1;priority;startdate;enddate;AccumulateU +sage|PACKID2;priority;startdate;enddate;AccumulateUsage|PACKID3;prior +ity;startdate;enddate;AccumulateUsage|PACKID4;priority;startdate;endd +ate;AccumulateUsage|\n"; while(<FH>) { chomp; my $line=$_; $SubsCount++; $msisdn; my $IMEI; my $Circle; my $DeviceType; my $OPTIN; my $PlanType; my $familyId; my $trafficIds; if($line=~/userId:S(\d+)\(\"(\w+)\"\)/) { $msisdn = $2; } if ( $line=~/operatorInfo:A(\d+)\[(.*?)\]/ ) { my $opcinfo=$2; if( $opcinfo =~ /ix(\d+):S(\d+)\(\"imei:(\w*)\"\)/ ) { $IMEI=$3; } if( $opcinfo =~ /ix(\d+):S(\d+)\(\"OptInState:(\w*)\"\)/ ) { $OPTIN=$3; } if( $opcinfo =~ /ix(\d+):S(\d+)\(\"CircleId:(\w*)\"\)/ ) { $Circle=$3; if( exists ( $lookup->{$Circle} ) ) { $Circle=$lookup->{$Circle}; } } if( $opcinfo =~ /ix(\d+):S(\d+)\(\"DevType:(\w*)\"\)/ ) { $DeviceType=$3; } if( $opcinfo =~ /ix(\d+):S(\d+)\(\"PlanType:(\w*)\"\)/ ) { $PlanType=$3; } } my @ValidPlan; if($line=~/groups:A(\d+)\[(.*?)\]/) { my $plans=$2; my @AllPlans = split('ix\d+:S\d+\("',$plans); foreach my $p ( @AllPlans ) { $p =~ s/\"\)//g; if ($p eq "" ) { next; } if ( $p =~ /(\w+):(\d+)[:]?(.*)/) { $planname=$1; my $priority=$2; my $expdate=$3; $expdate =~ s/,/\;/g; if( exists ( $AccUsg->{$msisdn}->{$planname} ) ) { if ( $expdate eq "") { push(@ValidPlan,"$planname;$priority;;;$AccUsg->{$m +sisdn}->{$planname}"); } elsif ( length($expdate) > 19 ) { push(@ValidPlan,"$planname;$priority;$expdate;$AccU +sg->{$msisdn}->{$planname}"); } else { push(@ValidPlan,"$planname;$priority;$expdate;;$Ac +cUsg->{$msisdn}->{$planname}"); } } else { if( $expdate eq "") { push(@ValidPlan,"$planname;$priority;;;"); } else { if( length($expdate) > 19 ) { push(@ValidPlan,"$planname;$priority;$ex +pdate;"); } else { push(@ValidPlan,"$planname;$priority +;$expdate;;"); } } } } } } if ( $line=~/familyId:S(\d+)\(\"(.*?)\"\)/ ) { $familyId=$2; } if ( $line=~/trafficIds:A(\d+)\[(.*?)\]/ ) { $trafficIds=$2; } my @y = sort { ($b =~ /(.*?);(\d+);(.*?)/)[1] <=> ($a =~ /(.*?);(\d+); +(.*?)/)[1] } @ValidPlan; #ankur my $printPlan=join("|",@y); $finalCount++; print OUT "$msisdn,$IMEI,$Circle,$DeviceType,$OPTIN,$PlanType,$AccUs +g1->{$msisdn}->{$planname},$AccUsg2->{$msisdn}->{$planname},$AccUsg3- +>{$msisdn}->{$planname}->{'time'},$AccUsg3->{$msisdn}->{$planname}->{ +'volume'},$printPlan\n"; close(FH); close(OUT);


In reply to Perl script is getting stuck for no reason by Ankur_kuls

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.