rajkrishna89 has asked for the wisdom of the Perl Monks concerning the following question:
i got a huge doc file in which i have to extract something..the scenario is
Module: 1 ID:001 Customer : yes Module: 2 ID:002 Customer : no Module: 3 ID:003 Customer : yes Module: 4 ID:004 Customer : no
I have to extract the ID no and Module no whose Customer tag is "Yes"
I have used an array to extract ID if its yes but its not taking the module name
my $i; for ($i = 0; $i <@array; $i++) { if($array[$i] =~ /^Customer\s : \sYes/) { for ($count = $i; $count >= 1; $count--) { if ($array[$count] =~ /ID\s*:\s*(.+)/ ) { $ID = $1; #PLACE WHERE THE ID GET EXTRACTED print "$ID \n"; for ($count = $i; $count >= 1; $count--) { if ($array[$count] =~ /Module:\s*(.+)/ ) { $MODULE_NAME = $1; print "$MODULE_NAME \n"; my $Mycell1 = $Sheet->Range($Sheet->Cells($ro +w, $col),$Sheet->Cells($row, $col+2)); $Mycell1->{Value}=["$ID","$MODULE_NAME","$Fil +e"]; $row++; goto breakingfunction; } } } } breakingfunction: } }
Im able to extract the ID but not the Module no..help out monks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need Help in Array
by Utilitarian (Vicar) on Jan 03, 2012 at 14:36 UTC | |
|
Re: Need Help in Array
by davido (Cardinal) on Jan 03, 2012 at 14:37 UTC | |
|
Re: Need Help in Array
by ansh batra (Friar) on Jan 03, 2012 at 19:03 UTC | |
by GrandFather (Saint) on Jan 03, 2012 at 23:36 UTC |