Comparing two text files.

2003-07-12 Thread Sara
## open (DATA, data.txt) || die Cannot open file. Reason: $!; @data = DATA; close(DATA); open (LIST, list.txt) || die Cannot open list.txt. Reason: $!; while (LIST) { $found = 0; foreach $line (@data) { chomp $line; if ($line eq $_) { $found = 1; last; } $found =

File::Copy CGI.pm

2003-07-12 Thread B. Fongo
Hi, I've a small script intended for file transfer from a windows machine to a remote linux server. To implement that, I decided to use two module i.e File::Basename, File::Copy and CGI.pm. The File::Copy is working well locally, but it fails to copy files to a remote machine through the

Re: alarm(x) question.

2003-07-12 Thread Ramprasad
[EMAIL PROTECTED] wrote: I'm kind of new to Perl, so please forgive the question.. I'm trying to use perl to read a file and then run a program using the file. I also want to use the alarm(x) function to skip to the next entry in the files if it times out. Here's what Ive go so far: open

regular expression replacement

2003-07-12 Thread Ramprasad
if I have my $str = 'aw bcdefaw e a rt zzz kjkjkjaw qa' ; If I wish to replace everything between 'a' and 'zzz' With 'TXT' I do $str=~s/a[^a]+zzz/aTXTzzz/; This works fine. Now if I wish to replace everything between 'aw' and 'zzz' with 'TXT' I am not able to use $str=~s/aw[^(aw)]+zzz/awTXTzzz/;

Re: alarm(x) question.

2003-07-12 Thread Kevin Pfeiffer
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Hi, I'm kind of new to Perl, so please forgive the question.. I'm trying to use perl to read a file and then run a program using the file. I also want to use the alarm(x) function to skip to the next entry in the files if it times

Re: regular expression replacement

2003-07-12 Thread John W. Krahn
Ramprasad wrote: if I have my $str = 'aw bcdefaw e a rt zzz kjkjkjaw qa' ; If I wish to replace everything between 'a' and 'zzz' With 'TXT' I do $str=~s/a[^a]+zzz/aTXTzzz/; This works fine. Now if I wish to replace everything between 'aw' and 'zzz' with 'TXT' I am not able to use

Re: regular expression replacement

2003-07-12 Thread Michael Pohl
If you want want to replace everything between the innermost occurrence of aw ??? zzz you may try this $str =~ s/aw.*?(?!aw)zzz/awTXTzzz/; the '.*?(?!aw)' takes care that between 'aw' and 'zzz' anything but 'aw' will match. Schirr if I have my $str = 'aw bcdefaw e a rt zzz kjkjkjaw

Re: regular expression replacement

2003-07-12 Thread Ramprasad
Michael Pohl wrote: If you want want to replace everything between the innermost occurrence of aw ??? zzz you may try this $str =~ s/aw.*?(?!aw)zzz/awTXTzzz/; the '.*?(?!aw)' takes care that between 'aw' and 'zzz' anything but 'aw' will match. Doesnot work #!/usr/bin/perl # use strict; my

Re: regular expression replacement

2003-07-12 Thread Ramprasad
John W. Krahn wrote: Ramprasad wrote: if I have my $str = 'aw bcdefaw e a rt zzz kjkjkjaw qa' ; If I wish to replace everything between 'a' and 'zzz' With 'TXT' I do $str=~s/a[^a]+zzz/aTXTzzz/; This works fine. Now if I wish to replace everything between 'aw' and 'zzz' with 'TXT' I am not able to

Re: regular expression replacement

2003-07-12 Thread Michael Pohl
Damn... switch the negative lookahead with the point -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

DBD::mysql::st execute failed: Got error -1 from table handler

2003-07-12 Thread Puth Chan Choth
Hello all, Why do I get DBD::mysql::st execute failed: Got error -1 from table handler at sys.pl line 40? My line 40 is: $sth-execute() or die $dbh-errstr \n; Thank you so much for your assistance. Best regards, Chan Choth -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: regular expression replacement

2003-07-12 Thread Rob Dixon
Ramprasad wrote: John W. Krahn wrote: Ramprasad wrote: if I have my $str = 'aw bcdefaw e a rt zzz kjkjkjaw qa' ; If I wish to replace everything between 'a' and 'zzz' With 'TXT' I do $str=~s/a[^a]+zzz/aTXTzzz/; This works fine. Now if I wish to replace everything

Re: regular expression replacement

2003-07-12 Thread Michael Pohl
Combining John's answer and a variant of Michael's: my $str = q/aw bcdefaw e a rt zzz kjkjkjaw qa/; print $str\n; # Look for a string $str =~ s/ (?=aw) # Preceded by 'aw' ((?!aw).)*? # Not containing 'aw' (?=zzz) # followed by 'zzz' /TXT/x;

Re: alarm(x) question.

2003-07-12 Thread denis
This will work, but wont solve the problem of the alarm exiting the loop before the file has been totaly proccessed. On Sat, 12 Jul 2003, Ramprasad wrote: [EMAIL PROTECTED] wrote: I'm kind of new to Perl, so please forgive the question.. I'm trying to use perl to read a file and then

Being a moron CGI.pm

2003-07-12 Thread Rus Foster
Hi All, I know what I'm about to ask is a really stupid question but I just can't get my head around my first outing with CGI.pm. I've RTFM as appropiate but getting nowhere. All I want to do is dump a list of variable and their values which have been parsed to a script. So far I have

Re: Being a moron CGI.pm

2003-07-12 Thread Rob Dixon
Rus Foster wrote: Hi All, I know what I'm about to ask is a really stupid question but I just can't get my head around my first outing with CGI.pm. Don't worry. First dates are always a problem, but just remember that CGI.pm is probably feeling just the same. Relax and enjoy yourselves. I've

Re: Being a moron CGI.pm

2003-07-12 Thread Tassilo von Parseval
On Fri, Jul 11, 2003 at 11:53:55PM -0700 Rus Foster wrote: I know what I'm about to ask is a really stupid question but I just can't get my head around my first outing with CGI.pm. I've RTFM as appropiate but getting nowhere. All I want to do is dump a list of variable and their values which

Re: help needed for LWP

2003-07-12 Thread Rob Dixon
Charu wrote: i am a beginner to this world of perl. i am not able to run my script using the LWP package. i couldn't figure out what was the error. can anyone tell me where to save the file and how to open it precisely. i ma using Windows 2000 (can i use IIS as the server?) . Also, does

Re: DBD::mysql::st execute failed: Got error -1 from table handler

2003-07-12 Thread Rob Dixon
Puth Chan Choth wrote: Hello all, Why do I get DBD::mysql::st execute failed: Got error -1 from table handler at sys.pl line 40? My line 40 is: $sth-execute() or die $dbh-errstr \n; Thank you so much for your assistance. It's my guess that you SQL content is wrong. Please show us a little

Search and Replace

2003-07-12 Thread Mike Flannigan
OK, I'm a real newbie, but even I am ashamed to be asking this. I want to search for a vertical mark ( | ) and replace it with something else (h). That's all - nothing fancy. What am I doing wrong here: use strict; use warnings; my $listelem = 52101.txt; #Open file in listelem if it exists if

RE: Search and Replace

2003-07-12 Thread Tim Johnson
In general, what you want to do is this; 1. open the file for reading 2. open a second file for writing 3. read in each line, doing the substitution (although technically using the tr/// operator might be quicker) 4. after each substitution, print the result to the second file 5. once

Hex files manipulation problem

2003-07-12 Thread Rafaqat Ali Chaudhary
Hi every body, I've got here a script which extracts event logs from Hexadecimal files by parsing them for a certain pattern set. The script runs fine on Solaris 8 (running on a SUN box) but fails on Linux or a Windows box. Somebody please guide me in this regard. Thanks in advance. Rafaqat Ali

Re: Hex files manipulation problem

2003-07-12 Thread John W. Krahn
Rafaqat Ali Chaudhary wrote: Hi every body, Hello, I've got here a script which extracts event logs from Hexadecimal files by parsing them for a certain pattern set. The script runs fine on Solaris 8 (running on a SUN box) but fails How does it fail? What does it do when it fails? Are

File::Copy CGI.pm

2003-07-12 Thread B. Fongo
Hi, I've a small script intended for file transfer from a windows machine to a remote linux server. To implement that, I decided to use two module i.e File::Basename, File::Copy and CGI.pm. The File::Copy is working well locally, but it fails to copy files to a remote machine through the

Re: Hex files manipulation problem

2003-07-12 Thread Rob Dixon
Rafaqat Ali Chaudhary wrote: Hi every body, I've got here a script which extracts event logs from Hexadecimal files by parsing them for a certain pattern set. The script runs fine on Solaris 8 (running on a SUN box) but fails on Linux or a Windows box. Hi. Look at all that John mentioned,

RE: Hex files manipulation problem

2003-07-12 Thread Rafaqat Ali Chaudhary
Following is the code: 1. open(FILE, $l_file) || 2. die Unable to open data file ($l_file); 3. for ( ;; ) { 4. $length = read(FILE,$block,2048); 5. if ( !defined($length) || $length == 0 ) { 6. # Normal end of file 7.

Re: Hex files manipulation problem

2003-07-12 Thread John W. Krahn
Rafaqat Ali Chaudhary wrote: Following is the code: 1.open(FILE, $l_file) || 2.die Unable to open data file ($l_file); You should include the $! variable in your error message so you know why the error occurred. To make this code portable across different platforms you are

Re: File::Copy CGI.pm

2003-07-12 Thread Rob Dixon
B. Fongo wrote: Hi, I've a small script intended for file transfer from a windows machine to a remote linux server. To implement that, I decided to use two module i.e File::Basename, File::Copy and CGI.pm. The File::Copy is working well locally, but it fails to copy files to a remote

RE: Hex files manipulation problem

2003-07-12 Thread Rafaqat Ali Chaudhary
That's Great. Using binmode has solved my problem. Yes the data files were created at a big-endian SPARC machine and were FTPed to a little-endian Intel based machine. Thanks for the help. Regards Rafaqat Ali Chaudhary -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED]

RE: Hex files manipulation problem

2003-07-12 Thread Rafaqat Ali Chaudhary
Got another problem: Following line of code fails if directory contains more than 1400 or so files: 1. my @filelist = glob(input/switch1*.evt); Any help will be highly appreciated. Regards Rafaqat Ali Chaudhary -Original Message- From: Rafaqat Ali Chaudhary [mailto:[EMAIL PROTECTED]

Re: Hex files manipulation problem

2003-07-12 Thread John W. Krahn
Rafaqat Ali Chaudhary wrote: Got another problem: Following line of code fails if directory contains more than 1400 or so files: 1. my @filelist = glob(input/switch1*.evt); Any help will be highly appreciated. On some versions of Perl the glob operator uses the shell (csh AFAIK) to

use GD::Graph::linespoints;

2003-07-12 Thread Jerry Preston
Hi! I am trying to change the background color of my graph, I do not quite understand how to do it. I have read the doc a number of times an I am missing it. I am looking for a working examples. Are there any on the web? Thanks, Jerry