##
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 =
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
[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
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/;
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
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
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
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
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
Damn...
switch the negative lookahead with the point
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
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,
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
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;
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
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
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
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
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
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
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
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
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
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
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
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,
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.
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
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
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]
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]
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
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
32 matches
Mail list logo