Re: Delete a particular line from file

2007-05-17 Thread sivasakthi
Yes i got it.. it works fine well. Thanks a lots.. Siva > Hello, > > Here you may try to do, > while() { > chomp; > $arrskip{$_} = 1; > } > > chomp would remove newline symbol (on Unix it's "\n") reading from the > original file. > -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Delete a particular line from file

2007-05-17 Thread Jeff Pang
sivasakthi 写道: open FF, "/tmp/userip.txt" or die $!; $arrskip{$_}= 1 while (); Hello, Here you may try to do, while() { chomp; $arrskip{$_} = 1; } chomp would remove newline symbol (on Unix it's "\n") reading from the original file. -- http://home.arcor.de/jeffpang/ -- To unsubsc

Re: Delete a particular line from file

2007-05-17 Thread sivasakthi
On Tue, 2007-05-15 at 12:25 +0800, Jeff Pang wrote: > sivasakthi 写道: > > Hi, > > > > I have used the file in perl, file contains like that, > > > > 1176369096.111468 172.16.2.80 TCP_MISS/200 9629 > > 1176378643.614458 172.16.2.80 TCP_MISS/200 9626 > > 1176378681.984662 172.16.2.75 T

Re: Read data in to Hash

2007-05-17 Thread Steve Bertrand
>> %arrskip{$_}=1; > > $arrskip{ $_ } = 1; Only because this was clearly untested code as was the rest, correct John? Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Read data in to Hash

2007-05-17 Thread John W. Krahn
sivasakthi wrote: > Hi, Hello, > Is it a correct way to read datas in to hash? > > use strict; > use warnings; > > $userpath = "/tmp/sample.txt"; my $userpath = "/tmp/sample.txt"; > open FF, "cat $userpath |" || die "can't access log file\n"; open FF, '<', $userpath or die "can't access '$us

Re: matching labels

2007-05-17 Thread xavier mas
El Jueves 17 Mayo 2007 22:11, Dr.Ruud escribió: > xavier mas schreef: > > I have a little problem don't have how to solve regarding matching. I > > am working with xml files that contain labels marking the text inside > > them. > > Use an XML-parser. > http://search.cpan.org/search?m=module&q=XML+p

Re: Read data in to Hash

2007-05-17 Thread Jeff Pang
sivasakthi 写道: > Hi, > > Is it a correct way to read datas in to hash? > > use strict; > use warnings; > > $userpath = "/tmp/sample.txt"; > open FF, "cat $userpath |" || die "can't access log file\n"; Don't try to open a pipe when built-in "open" call is available. "cat xxx|" would call a exter

Re: Read data in to Hash

2007-05-17 Thread yitzle
On 5/18/07, sivasakthi <[EMAIL PROTECTED]> wrote: Hi, Is it a correct way to read datas in to hash? use strict; use warnings; $userpath = "/tmp/sample.txt"; open FF, "cat $userpath |" || die "can't access log file\n"; while () { %arrskip{$_}=1; } close (FF); Thanks, Siva $arrskip{$_} = 1;

Read data in to Hash

2007-05-17 Thread sivasakthi
Hi, Is it a correct way to read datas in to hash? use strict; use warnings; $userpath = "/tmp/sample.txt"; open FF, "cat $userpath |" || die "can't access log file\n"; while () { %arrskip{$_}=1; } close (FF); Thanks, Siva

Re: pass variable to another program

2007-05-17 Thread yaron
Hi, I think that you are looking for a serialization mechanism. For that you can use the Storable module (http://search.cpan.org/~ams/Storable-2.16/Storable.pm) All you need to do is to freeze the variable in the first process, send it by pipe and thaw it in the other process. Yaron Kahanovitc

Re: Store contents of array in a variable?

2007-05-17 Thread yaron
i again A little correction: my $var = join ("delimiter",@$array_ref); Yaron Kahanovitch - Original Message - From: [EMAIL PROTECTED] To: "Romeo Theriault" <[EMAIL PROTECTED]> Cc: beginners@perl.org Sent: 23:53:23 (GMT+0200) Asia/Jerusalem יום חמישי 17 מאי 2007 Subject: Re: Store conten

Re: Store contents of array in a variable?

2007-05-17 Thread yaron
Hi, >From your question I understand that you are looking for the join commang: my $var = join ("delimiter",[EMAIL PROTECTED]); Hope that helps Yaron Kahanovitch - Original Message - From: "Romeo Theriault" <[EMAIL PROTECTED]> To: beginners@perl.org Sent: 23:39:22 (GMT+0200) Asia/Jerusa

Store contents of array in a variable?

2007-05-17 Thread Romeo Theriault
This is probably a dumb question but is it possible to store the contents of an array into a variable? Something like this: $variable = foreach $array_ref7 (@rowstash7) { return "@$array_ref7\n"; } I have this script below in which I am trying to send the contents of an array within a

Re: matching labels

2007-05-17 Thread Dr.Ruud
xavier mas schreef: > I have a little problem don't have how to solve regarding matching. I > am working with xml files that contain labels marking the text inside > them. Use an XML-parser. http://search.cpan.org/search?m=module&q=XML+parse -- Affijn, Ruud "Gewoon is een tijger." -- To un

RE: pass variable to another program

2007-05-17 Thread Brian Volk
> -Original Message- > From: Andy Greenwood [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 17, 2007 12:51 PM > To: Brian Volk > Cc: beginners@perl.org > Subject: Re: pass variable to another program > > On 5/17/07, Brian Volk <[EMAIL PROTECTED]> wrote: > > Hello, > > > > > > > > Is ther

Re: matching labels

2007-05-17 Thread yitzle
I suppose you could use a stack object. Perl ought to have one... Check CPAN. A stack lets you push items on and pop them off. You can read a a tag. Its its an open tag, you push it to the stack. If its a close, you pop the top item and check it matches. On 5/17/07, xavier mas <[EMAIL PROTECTED]>

matching labels

2007-05-17 Thread xavier mas
Hello list! I have a little problem don't have how to solve regarding matching. I am working with xml files that contain labels marking the text inside them. I need to find for each of this lines labels that are the same and mix its contents up. For instance: CONTENT1>CONTENT2>CONTENT3 CONTE

Re: pass variable to another program

2007-05-17 Thread Steve Bertrand
Brian Volk wrote: > Hello, > > > > Is there a way to pass a variable from one program to another? I have a > web site that allows the user to set the time they would like to > download a file... The program uses the Linux "at" command and launches > another perl program that does the actual FT

Re: pass variable to another program

2007-05-17 Thread Andy Greenwood
On 5/17/07, Brian Volk <[EMAIL PROTECTED]> wrote: Hello, Is there a way to pass a variable from one program to another? I have a web site that allows the user to set the time they would like to download a file... The program uses the Linux "at" command and launches another perl program that d

pass variable to another program

2007-05-17 Thread Brian Volk
Hello, Is there a way to pass a variable from one program to another? I have a web site that allows the user to set the time they would like to download a file... The program uses the Linux "at" command and launches another perl program that does the actual FTP download. I would like to pass

Re: Net::Telnet --help required

2007-05-17 Thread a b
Hi Jay, Thanks for your resoponse. I tried with the suggested but it failed due to timed out (j.pl) use Net::Telnet; my $t = new Net::Telnet; $t->open("slias10"); print($t->waitfor('/login:.*$/')); $t->print("root"); sleep(2); @forecast=$t->cmd("/usr/bin/ls"); print @forecast; C:\>perl j.pl HP

Re: Module question

2007-05-17 Thread Jeff Pang
Robert Hicks 写道: Is @EXPORT_OK for those items you want to import by "name" and %EXPORT_TAGS for those items you want to group like :all or :select? Almost right. What is @EXPORT used for then if that is the case above? @EXPORT was used for exporting symbol (methods or variables) by defa

Module question

2007-05-17 Thread Robert Hicks
Is @EXPORT_OK for those items you want to import by "name" and %EXPORT_TAGS for those items you want to group like :all or :select? What is @EXPORT used for then if that is the case above? Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ht

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
Of Course Rob, i always use strict and warnings... Since i had to write a pseudocode, i did not write them. But i wil lsurely keep this in mind. :-) Thank you... :-) On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote: Sure, though I do not see why you would not want to use strict and warnings (you

Re: Delete a particular line from file

2007-05-17 Thread sivasakthi
On Thu, 2007-05-17 at 07:50 -0400, Chas Owens wrote: > Did you type > > OUTER: > while() { > > or just > > while () { I have used as, OUTER: while () { Thanks, Siva -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Regarding pattern matching

2007-05-17 Thread Matthew J. Avitable
Dharshana Eswaran wrote: Hi All, I am trying to extract few strings from a text file. The pattern of the text stored in the file is as follows: #define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */ I need to extract MNSS_FACILITY_IND_ID, TF_MNSS_ME

RE: Regarding pattern matching

2007-05-17 Thread Moon, John
Subject: Regarding pattern matching Hi All, I am trying to extract few strings from a text file. The pattern of the text stored in the file is as follows: #define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */ I need to extract MNSS_FACILITY_IND_ID, TF_M

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
Sure, though I do not see why you would not want to use strict and warnings (you should should should or the people on this list will hunt you down and ) anyway Data::Dumper was just there for convenience: #!/usr/local/bin/perl #use strict; #use warnings; my $string = '#define MNSS_FACILIT

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
Thank you But i want to try without using any perl modules. Can you suggest some way with no modules used in that? Thanks and Regards, Dharshana On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote: On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote: > > How about this? > > > #!/usr/local/bin/pe

Re: Delete a particular line from file

2007-05-17 Thread Chas Owens
On 5/17/07, sivasakthi <[EMAIL PROTECTED]> wrote: snip > OUTER: > while() { >my ($time, $lport, $ip, $stats, $rport) = split; >for my $skip_ip (@ip) { > next OUTER if $ip eq $skip_ip; >} ># using those values above to create hash >#based on what form of hash you needed.

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
On 5/17/07, Rob Coops <[EMAIL PROTECTED]> wrote: How about this? #!/usr/local/bin/perl use strict; use warnings; my $string = '#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */'; my @parts = $string =~ m/\s+?(\w+)\s+?\((\w+.*?)\)[EMAIL PROTECTED]

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
How about this? #!/usr/local/bin/perl use strict; use warnings; my $string = '#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */'; my @parts = $string =~ m/\S+?(\w+)\s+?\((\w+.*?)\)[EMAIL PROTECTED](\w+).*/; use Data::Dumper; print Dumper @parts;

Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
Hi All, I am trying to extract few strings from a text file. The pattern of the text stored in the file is as follows: #define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */ I need to extract MNSS_FACILITY_IND_ID, TF_MNSS_MESSAGE_CATEGORY + 0x01 and MNSS

Re: Delete a particular line from file

2007-05-17 Thread Penny Y. Hohimer
> On Wed, 2007-05-16 at 08:01 -0400, Chas Owens wrote: > >> >> Assuming that you have a list of IP addresses you want to skip in @ip, >> you could say >> >> #!/usr/bin/perl >> >> use strict; >> use warnings; >> >> OUTER: >> while() { >>my ($time, $lport, $ip, $stats, $rport) = split; >>for