Attachment got blocked .... Sending again _____
From: Sayed, Irfan (Irfan) Sent: Wednesday, November 29, 2006 4:35 PM To: 'Mug' Cc: 'beginners@perl.org' Subject: RE: delete function Hi Mug, Thanks for your mail. I have attached my script for your reference. I have updated my script as per your suggesion but still i am not getting proper result. Let me explain you what my script does. I have one array called as @repl which contains some values. I have taken another array called as @foo and greped @repl array for "pu_" string and stored the output in @foo Now i need to delete all values(strings) which contains "pu_" from @repl array. So can you please look into the script and let me know where i am wrong Regards Irfan. _____ From: Mug [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 29, 2006 3:29 PM To: Sayed, Irfan (Irfan) Subject: Re: delete function Hi Irfan, You may reply to the list next time, so more people could help. Sayed, Irfan (Irfan) wrote: Hi Mug, I did not get the meaning of following lines This is the exact code. Have you tried to run it ? Or do you have any code and bring out to discuss ? my %H ; $H{$_} = '' for @A; This is to use the the elems in the array to becoming keys of a hash, ie. %H ( this also quite a common technique to handling array by hash ) delete $H{$_} for ( @KILL ) ; And then, use a loop to delete all the keys that you want to delete ( the elems you want to delete ) , @A = keys %H; # The order becomes random print "@A"; And finally take back the rest of keys from Hash , %H and put back to the original array @A . Good luck, Mug Could you please give me exact code and explain how it works I will be highly obliged if you do the same. Regards Irfan. -----Original Message----- From: Mug [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 29, 2006 2:07 PM To: Sayed, Irfan (Irfan) Cc: beginners@perl.org Subject: Re: delete function Sayed, Irfan (Irfan) wrote: Hi, I have two arrays . one array contains the element which needs to be deleted from the secound array in which that element is already present. I have tried using delete function but somehow i did not succeed. Could somebody please help me on this Regards Irfan.
# Perl script to check the replicas are in sync use strict; use warnings; my %hash; my @repl1; my $key = "pu"; my @repl; my @foo; my $CT = "/usr/atria/bin/cleartool"; my $MT = "/usr/atria/bin/multitool"; my @vob_list = `$CT lsvob -s`; foreach (@vob_list) { @repl = `$CT lsreplica -fmt "%n\n" -invob $_`; @foo = grep { /pu_/i } @repl; $hash{$_} = "for @repl"; delete $hash{$_} for (@foo); @repl = keys %hash; print @repl; #print @foo; }
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>