Hello everyone!
I have written a perl script which opens a file for reading and writing.
I tested what happens if the script is run in multiple instances by the
webserver. I put a sleep command between seeking writing position in
the file and actual writing. I filled the web form in two
On Wednesday April 25 2007 6:14 am, Varjü Tamás wrote:
Hello everyone!
I have written a perl script which opens a file for reading and writing.
I tested what happens if the script is run in multiple instances by the
webserver. I put a sleep command between seeking writing position in
the
On Wednesday April 25 2007 8:42 am, Varjü Tamás wrote:
Dear Greg!
The reason I did the test, and why I detailed the result is that I could
not reproduce any of the nasty things which can happen without locking.
I know that everyone suggests to use the lock, but following your
argument the
On Wed, Apr 25, 2007 at 01:37:24AM -0400, yitzle wrote:
Warning message:
Use of uninitialized value in numeric comparison (=) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} = $dHash{$a}{'VAL'} } keys %dHash) {
perhaps
foreach (sort { $dHash{$b}{'VAL'} = $dHash{$a}{'VAL'} }
HI All,
I need to use CQPerlExt module in my Perl script. I searched CPAN but
did not find anything.
Can anybody plz help me in getting this..
Regards
Irfan.
Sayed, Irfan (Irfan) 写道:
HI All,
I need to use CQPerlExt module in my Perl script. I searched CPAN but
did not find anything.
Can anybody plz help me in getting this..
Regards
Irfan.
IBM Rational ClearQuest
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
Rob Dixon wrote:
Andrej Kastrin wrote:
Dear all,
Question about the sum function; the file structure is as follows:
A|100
A|200
A|150
B|20
B|90
C|10
C|30
C|300
The result I want to obtain is to sum values in the second column
(columnB) for each particular letter in the first column
Hi,
Can I send a kill signal to a process which is created using
system call ?
Basically I wanted to send a CTRL-C signal to the process
created by system call (of course in the same program).
Something like this :
sub test()
On Wed, Apr 25, 2007 at 03:12:38PM +0530, Nath, Alok (STSD) wrote:
Hi,
Can I send a kill signal to a process which is created using
system call ?
Basically I wanted to send a CTRL-C signal to the process
created by system call (of course in the same program).
Saravana Kumar wrote:
yitzle wrote:
You can read one list into an array (@list) and then loop through the
other file ($item) and grep the list for the item.
for ($item = ) { # or foreach
print $item found if ( grep $item, @list );
}
On 4/20/07, Saravana Kumar [EMAIL PROTECTED]
Stanislav Nedelchev wrote:
Rob Dixon wrote:
Andrej Kastrin wrote:
Dear all,
Question about the sum function; the file structure is as follows:
A|100
A|200
A|150
B|20
B|90
C|10
C|30
C|300
The result I want to obtain is to sum values in the second column
(columnB) for each particular letter
Actually the following isnt working:
use Math::BigFloat;
$n = 0;
if ($n-is_zero()) {print 'you entered zero'}
On 4/25/07, Tom Phoenix [EMAIL PROTECTED] wrote:
On 4/24/07, Somu [EMAIL PROTECTED] wrote:
I'm unable to compare numbers using the module. Actually i can only
use it to create
Hi all,
I was resorting to this verbatim html print
to do the task:
print qq(FORM METHOD=POST ACTION=myscript.cgi\n);
print qq(INPUT type=hidden NAME=analysis VALUE=Light\n);
print qq(INPUT type=hidden NAME=organism VALUE=$orgname\n);
print qq(INPUT type=hidden NAME=sequence VALUE=$fname
Hi,
But for this you need to know the process id.
The system command doesn't returns, I think ?
~AN.
-Original Message-
From: Owen Cook [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 25, 2007 4:02 PM
To: beginners@perl.org
Subject: Re: Killing a process created using system
On Wed,
On 4/25/07, Somu [EMAIL PROTECTED] wrote:
Actually the following isnt working:
use Math::BigFloat;
$n = 0;
if ($n-is_zero()) {print 'you entered zero'}
snip
Umm, that is because $n is not a Math::BigFloat. Math::BigFloat is
not a pragma, it is a class that overloads the math operators so
On 4/25/07, Nath, Alok (STSD) [EMAIL PROTECTED] wrote:
Hi,
But for this you need to know the process id.
The system command doesn't returns, I think ?
~AN.
Take a look at the alarm function.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Wijaya Edward wrote:
Hi all,
I was resorting to this verbatim html print
to do the task:
print qq(FORM METHOD=POST ACTION=myscript.cgi\n);
print qq(INPUT type=hidden NAME=analysis VALUE=Light\n);
print qq(INPUT type=hidden NAME=organism VALUE=$orgname\n);
print qq(INPUT type=hidden
On 4/25/07, yitzle [EMAIL PROTECTED] wrote:
Warning message:
Use of uninitialized value in numeric comparison (=) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} = $dHash{$a}{'VAL'} } keys %dHash) {
How do I fix? Should my sort function be checking for variable
defined? What do I return on
why wont the following work?
$q = shift;
$p = pass;
if ( $q =~ m/$p/i ) { print 'match' }
But it works on changing the $q and $p places..
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 25 Apr 2007 at 18:58, Somu wrote:
why wont the following work?
$q = shift;
$p = pass;
if ( $q =~ m/$p/i ) { print 'match' }
But it works on changing the $q and $p places..
Not sure but it works for me.
#!/bin/perl
use strict;
use warnings;
my $q = shift;
my $p = pass;
if (
On 4/25/07, Somu [EMAIL PROTECTED] wrote:
why wont the following work?
$q = shift;
$p = pass;
if ( $q =~ m/$p/i ) { print 'match' }
But it works on changing the $q and $p places..
Since we don't know what $q is we can't really help you. Please
produce a repeatable test.
--
To
Somu wrote:
why wont the following work?
$q = shift;
$p = pass;
if ( $q =~ m/$p/i ) { print 'match' }
But it works on changing the $q and $p places..
This will output 'match' if the string in $q contains the string 'pass'
anywhere within it, in either (or mixed) case.
What do you think is
On 4/25/07, Sayed, Irfan (Irfan) [EMAIL PROTECTED] wrote:
I need to use CQPerlExt module in my Perl script. I searched CPAN but
did not find anything.
http://www-1.ibm.com/support/docview.wss?uid=swg21129877
Cheers!
--Tom Phoenix
Stonehenge Perl Training
--
To unsubscribe, e-mail:
On 4/25/07, Nath, Alok (STSD) [EMAIL PROTECTED] wrote:
Can I send a kill signal to a process which is created using
system call ?
No. system() won't return while the child process is still running.
If you have the process running in parallel (such as with fork, or a
piped
Inside the loop I check if the value is defined, so I don't care where
in the order the undefined one shows up in. I don't want to delete
undefined ones or anything...
On 4/25/07, Chas Owens [EMAIL PROTECTED] wrote:
On 4/25/07, yitzle [EMAIL PROTECTED] wrote:
Warning message:
Use of
On 4/24/07, yitzle [EMAIL PROTECTED] wrote:
Warning message:
Use of uninitialized value in numeric comparison (=) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} = $dHash{$a}{'VAL'} } keys %dHash) {
How do I fix?
Give it an initialized value. Maybe like this?
sort { ($dHash{$b}{VAL} || 0) =
On 4/25/07, yitzle [EMAIL PROTECTED] wrote:
Inside the loop I check if the value is defined, so I don't care where
in the order the undefined one shows up in. I don't want to delete
undefined ones or anything...
Then you can either turn off the warnings for that section (not
advised), ignore
yitzle wrote:
On 4/25/07, Chas Owens [EMAIL PROTECTED] wrote:
On 4/25/07, yitzle [EMAIL PROTECTED] wrote:
Warning message:
Use of uninitialized value in numeric comparison (=) at ...
Code:
foreach (sort { $dHash{$b}{'VAL} = $dHash{$a}{'VAL'} } keys %dHash) {
How do I fix? Should my sort
yitzle wrote:
Inside the loop I check if the value is defined, so I don't care where
in the order the undefined one shows up in. I don't want to delete
undefined ones or anything...
On 4/25/07, Chas Owens [EMAIL PROTECTED] wrote:
On 4/25/07, yitzle [EMAIL PROTECTED] wrote:
Warning message:
In that case just create a list of the keys with a defined VAL value
before you do the sort:
my @keys = grep defined $dHash{$_}{VAL}, keys %dHash;
foreach (sort { $dHash{$b}{VAL} = $dHash{$a}{VAL} } @keys) {
print $_, \n;
}
HTH,
Rob
This solution appeals to me. I'll use it.
Somu wrote:
On 4/25/07, Tom Phoenix [EMAIL PROTECTED] wrote:
On 4/24/07, Somu [EMAIL PROTECTED] wrote:
I'm unable to compare numbers using the module. Actually i can only
use it to create numbers like 0 or inf or 1 or their negatives. But i
dont know how to use their methods. Bcoz the
yitzle wrote:
P.S. What's HTH?
Hope This Helps :)
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
John W. Krahn wrote:
The warnings pragma was introduced in Perl version 5.6
perldoc perl56delta
If you are using Perl version 5.005_03 then you will have to use the -w switch
instead like:
#!/usr/bin/perl -w
John,
Thanks. I have been using this program without problem for a while,
On 4/25/07, yitzle [EMAIL PROTECTED] wrote:
P.S. What's HTH?
http://www.google.com/search?q=What+does+hth+stand+for%3F
Cheers!
--Tom Phoenix
Stonehenge Perl Training
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Believe it is 'Hope this helps!'.
If you have any problems or questions, please let me know.
Thanks.
Wags ;)
David R Wagner
Senior Programmer Analyst
FedEx Freight
1.408.323.4225x2224 TEL
1.408.323.4449 FAX
http://fedex.com/us
-Original Message-
Tom Phoenix wrote:
On 4/25/07, yitzle [EMAIL PROTECTED] wrote:
P.S. What's HTH?
http://www.google.com/search?q=What+does+hth+stand+for%3F
In a different context, every once in a while, I've seen it used as 'How
The Hell', but most certainly know it as how the link describes it above.
What's the best way to apply a RegEx to an array? For loop?
@arr = qw/dc2ds reew12dsfa df2fdw/;
s/$find/$replace/ for(@arr);
Thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
`cat m.top.html m.mid.html m.arc.html m.bot.html blah`
How can this be done without a system call?
Here's my first guess:
@doc = ();
for (qw/m.top.html m.mid.html m.arc.html m.bot.html/) {
open $FILE,,$root/$_;
my @tmp = $FILE;
@doc = (@doc,@tmp);
close $FILE;
}
I got an input source that got records of fixed number of lines, eg
Name, Address, Age, Phone, Cell
I'm not interested in Age or Cell.
I'm doing something along the lines of the following. Can I do better?
my @lines = qw/name address age phone cell end/;
my %process = {name=1, address=1,
yitzle wrote:
What's the best way to apply a RegEx to an array? For loop?
@arr = qw/dc2ds reew12dsfa df2fdw/;
s/$find/$replace/ for(@arr);
Yes. Exactly that.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
yitzle wrote:
`cat m.top.html m.mid.html m.arc.html m.bot.html blah`
How can this be done without a system call?
Here's my first guess:
@doc = ();
for (qw/m.top.html m.mid.html m.arc.html m.bot.html/) {
open $FILE,,$root/$_;
my @tmp = $FILE;
@doc = (@doc,@tmp);
close $FILE;
}
Hi:
The File::Basename from 5.8.0 doesnot work in Perl 5.8.2 or Perl 5.8.7. Is
there any particular reason.
I have a script that uses the Basename module was running file with 5.8.0,
but it doesnt work fine when i run the script in Perl 5.8.2 or Perl 5.8.7. I
tried copying the basename.pm from
yitzle wrote:
`cat m.top.html m.mid.html m.arc.html m.bot.html blah`
How can this be done without a system call?
Here's my first guess:
use warnings;
use strict;
@doc = ();
my @doc;
for (qw/m.top.html m.mid.html m.arc.html m.bot.html/) {
open $FILE,,$root/$_;
Where is $root
yitzle wrote:
What's the best way to apply a RegEx to an array? For loop?
@arr = qw/dc2ds reew12dsfa df2fdw/;
s/$find/$replace/ for(@arr);
Yes, although the parentheses are redundant.
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools
Hi:
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in perl?
Would this work --
my $fileName=$path =~ /.*\/(.+)$/;
Thanks!
yitzle wrote:
`cat m.top.html m.mid.html m.arc.html m.bot.html blah`
How can this be done without a system call?
As a general rule, if your script contains 'system()' anywhere in it, you've
done it wrong. This is especially true for simple file operations such as
the above, and for anything
yitzle wrote:
I got an input source that got records of fixed number of lines, eg
Name, Address, Age, Phone, Cell
So you are saying that 'Name' appears on every fifth line and *always* on
every fifth line?
I'm not interested in Age or Cell.
I'm doing something along the lines of the
yitzle wrote:
I got an input source that got records of fixed number of lines, eg
Name, Address, Age, Phone, Cell
I'm not interested in Age or Cell.
I'm doing something along the lines of the following. Can I do better?
my @lines = qw/name address age phone cell end/;
my %process = {name=1,
Nishi wrote:
Hi:
Hello,
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in perl?
Would this work --
my $fileName=$path =~ /.*\/(.+)$/;
Assuming that your file system uses / as the path separator:
( my
Nishi wrote:
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in perl?
Would this work --
my $fileName=$path =~ /.*\/(.+)$/;
Why don't you try it?!
It wouldn't work because $fileName would end up with
yitzle wrote:
I got an input source that got records of fixed number of lines, eg
Name, Address, Age, Phone, Cell
I'm not interested in Age or Cell.
I'm doing something along the lines of the following. Can I do better?
my @lines = qw/name address age phone cell end/;
my %process = {name=1,
Seanie wrote:
yitzle wrote:
`cat m.top.html m.mid.html m.arc.html m.bot.html blah`
How can this be done without a system call?
As a general rule, if your script contains 'system()' anywhere in it, you've
done it wrong. This is especially true for simple file operations such as
the above,
On 4/25/07, John W. Krahn [EMAIL PROTECTED] wrote:
Nishi wrote:
Hi:
Hello,
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in perl?
Would this work --
my $fileName=$path =~ /.*\/(.+)$/;
Assuming that
On 4/25/07, Nishi [EMAIL PROTECTED] wrote:
Hi:
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in perl?
Would this work --
my $fileName=$path =~ /.*\/(.+)$/;
Thanks!
There are many options, but none of
On 4/25/07, Nishi [EMAIL PROTECTED] wrote:
Hi:
The File::Basename from 5.8.0 doesnot work in Perl 5.8.2 or Perl 5.8.7. Is
there any particular reason.
I have a script that uses the Basename module was running file with 5.8.0,
but it doesnt work fine when i run the script in Perl 5.8.2 or Perl
yitzle wrote:
What's the best way to apply a RegEx to an array? For loop?
@arr = qw/dc2ds reew12dsfa df2fdw/;
s/$find/$replace/ for(@arr);
Yep, you can do that. Or use map()
map(s/$find/$replace/, @arr);
--
[EMAIL PROTECTED] [pgp: 8A8FA6DE]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
On 4/25/07, Seanie [EMAIL PROTECTED] wrote:
yitzle wrote:
What's the best way to apply a RegEx to an array? For loop?
@arr = qw/dc2ds reew12dsfa df2fdw/;
s/$find/$replace/ for(@arr);
Yep, you can do that. Or use map()
map(s/$find/$replace/, @arr);
You should not use map in a void context,
John W. Krahn wrote:
Your syntax for the open() statements is a bit dodgy too :-)
Perl defines the syntax so you must mean something else? :-)
As in too much unnecessary typing and commas and such, which don't really
add clarity, rather than incorrect
You should also include the $! or $^E
Chas Owens wrote:
map(s/$find/$replace/, @arr);
You should not use map in a void context, it is bad form.
Care to explain?
Neither 'strict' nor 'warnings' complains, and it does what it says on the
tin, but if I've missed something fundamental here I'd be grateful to know
about it.
--
Seanie wrote:
yitzle wrote:
What's the best way to apply a RegEx to an array? For loop?
@arr = qw/dc2ds reew12dsfa df2fdw/;
s/$find/$replace/ for(@arr);
Yep, you can do that. Or use map()
map(s/$find/$replace/, @arr);
Haha yes you can, but if you want to write nasty code go for
grep
Sean King wrote:
Chas Owens wrote:
map(s/$find/$replace/, @arr);
You should not use map in a void context, it is bad form.
Care to explain?
Neither 'strict' nor 'warnings' complains, and it does what it says on the
tin, but if I've missed something fundamental here I'd be grateful to know
Rob Dixon wrote:
map(s/$find/$replace/, @arr);
Haha yes you can, but if you want to write nasty code go for
grep s/$find/$replace/, @arr;
which also works.
True, but grep implies find stuff, while map implies do stuff, so your
nasty code is way, way, nastier than mine - it masks the
Seanie wrote:
John W. Krahn wrote:
Your syntax for the open() statements is a bit dodgy too :-)
Perl defines the syntax so you must mean something else? :-)
As in too much unnecessary typing and commas and such, which don't really
add clarity, rather than incorrect
The OP's open
Seanie wrote:
Rob Dixon wrote:
map(s/$find/$replace/, @arr);
Haha yes you can, but if you want to write nasty code go for
grep s/$find/$replace/, @arr;
which also works.
True, but grep implies find stuff, while map implies do stuff, so your
nasty code is way, way, nastier than mine -
On 4/25/07, John W. Krahn [EMAIL PROTECTED] wrote:
Seanie wrote:
Rob Dixon wrote:
map(s/$find/$replace/, @arr);
Haha yes you can, but if you want to write nasty code go for
grep s/$find/$replace/, @arr;
which also works.
True, but grep implies find stuff, while map implies do stuff, so
Hello all. I have a question regarding reading in a criteria file,
storing that criteria in memory and reading in user IDs from another
file periodically, comparing attributes associated to that ID to the
criteria i have stored, and placing those IDs which match into groups
defined by the
Sorry. The input file has one item per line. Line 1,6,11,etc has names #1,2,3,..
Line 2,7,12 has addresses #1,2,3...
I want to make a hash of hashed. hash{$name}{'address'} etc
I hope that's clear enough...
On 4/25/07, Seanie [EMAIL PROTECTED] wrote:
yitzle wrote:
I got an input source that
Rob:
On 4/25/07, Rob Dixon [EMAIL PROTECTED] wrote:
Nishi wrote:
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in perl?
Would this work --
my $fileName=$path =~ /.*\/(.+)$/;
Why don't you try it?!
Hi,
I am using perl which comes with RHEL distribution.
I think the perl version is 5.8.5.
I am not seeing any modules specific for message logging.
Does it have any ?
I am prohibited from installing any modules on top of my RHEL.
Thanks
Alok
--
my ($name) = $path =~ m|([^/]+)$|;
Shouldn't that be a =~ s|([^/]+)$|; not m?
On 4/26/07, Nishi [EMAIL PROTECTED] wrote:
Rob:
On 4/25/07, Rob Dixon [EMAIL PROTECTED] wrote:
Nishi wrote:
What is the equivalent of basename? Ie if I dont want to use basename
package to get the
On 4/26/07, Nath, Alok (STSD) [EMAIL PROTECTED] wrote:
Hi,
I am using perl which comes with RHEL distribution.
I think the perl version is 5.8.5.
I am not seeing any modules specific for message logging.
Does it have any ?
I am prohibited from installing
On 4/26/07, Nishi [EMAIL PROTECTED] wrote:
Rob:
On 4/25/07, Rob Dixon [EMAIL PROTECTED] wrote:
Nishi wrote:
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in perl?
Would this work --
my
On 04/25/2007 11:59 PM, Nishi wrote:
On 4/25/07, Rob Dixon [EMAIL PROTECTED] wrote:
[...]
my ($name) = $path =~ m|([^/]+)$|;
I tried it, but somehow doesnt work for me, printing $name returns me the
entire string such as C:\temp\abc\abc.txt and not abc.txt.
Am I missing something?
73 matches
Mail list logo