Hi,
how can I turn off stickiness for CGI's HTML methods.
Example:
I call a script with parameter mode=new and the following line
print $q-hidden('mode', 'slurp');
prints out
input type=hidden name=mode value=new /
instead of
input type=hidden name=mode value=slurp /
I tried the
Hi,
should have read perldoc *thoroughly*, sorry:
Note, that just like all the other form elements, the value of a
hidden field is sticky. If you want to replace a hidden field with
some other values after the script has been called once you'll have
to do it manually:
Jan == Jan Eden [EMAIL PROTECTED] writes:
Jan Hi,
Jan should have read perldoc *thoroughly*, sorry:
Note, that just like all the other form elements, the value of a
hidden field is sticky. If you want to replace a hidden field with
some other values after the script has been called once
How can I figure out how many chars are stored in a variable?
Or how can I determit the length of a string in a variable?
this methode is a little poor:
@array = split //, $var;
$size = scalar (@array);
Thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
See
perldoc -f length
Manav
-Original Message-
From: Bastian Angerstein [mailto:[EMAIL PROTECTED]
Sent: Friday, March 11, 2005 1:36 PM
To: beginners@perl.org
Subject: How to figure out Size of Var.
How can I figure out how many chars are stored in a variable?
Or how can I determit
print exists if $hash{key};
Obviously. But If I am just checking key exists , Is it worth having a
DB_File Hash
Thanks
Ram
--
Netcore Solutions Pvt. Ltd.
Website: http://www.netcore.co.in
Spamtraps:
On Thu, Mar 10, 2005 at 11:10:06AM -0500, Wiggins d'Anconia wrote:
Btw ... What perldoc can I read to read about '$#'?
Not sure, a quick glance at perldata discusses the -1 index usage, but
didn't turn up $# that I could see. Its in the books :-).
wiggim$ perldoc perldata | fgrep -c '$#'
Hi,
Suppose there is a string var = 123, I want to substitute 123 by 456,
then I have to write like this s/(var\s+=)\s+\d+/\1 123/. Is there a way
so that I can combine ' ' into the parenthesis as
s/(var\s+=\s+)\d+/\1456? I know \1456 is not correct, but how can I
seperate \1 and 456 without
Stone [S], on Thursday, March 10, 2005 at 16:46 (-0800) typed:
S That won't work either. When you say ([1-9]\d?) you're telling it
S (If there is a match) capture the stuff in parentheses and store it.
S When you say \1 you're telling the script you know that first
S batch of stuff you
Am Freitag, 11. März 2005 07.21 schrieb Zeng Nan:
Hi,
Suppose there is a string var = 123, I want to substitute 123 by 456,
then I have to write like this s/(var\s+=)\s+\d+/\1 123/. Is there a way
so that I can combine ' ' into the parenthesis as
s/(var\s+=\s+)\d+/\1456? I know \1456 is not
Suppose there is a string var = 123, I want to substitute 123 by 456,
then I have to write like this s/(var\s+=)\s+\d+/\1 123/. Is there a way
so that I can combine ' ' into the parenthesis as
s/(var\s+=\s+)\d+/\1456? I know \1456 is not correct, but how can I
seperate \1 and 456 without
I hope I don't have any bugs here :)
Just one. :)
Your expressions all say \d instead of \d? for the second digit in
each set, while the simple one correctly has \d?. So your
expressions had an unfair advantage and as a result finish faster.
Add \d? to your expressions, and you should find
On Fri, Mar 11, 2005 at 01:10:59AM -0800, Stone wrote:
Is there any chance you'll ever have var=123? Your expression
currently requires the spaces. As far as I can tell, all you're doing
is replacing the numbers on the right hand side of the string. So,
how about using this instead:
Hi,
I have a program that extracts variables from a list of flatfiles and I want to
insert these variables into a PostreSQL database.
I was planning on creating a CSV file with a line allocated for each file which
can then be inserted into the database using the COPY command.
Is the best way
SG Edwards [EMAIL PROTECTED] asked:
I have a program that extracts variables from a list of
flatfiles and I want to insert these variables into a
PostreSQL database.
I was planning on creating a CSV file with a line allocated
for each file which can then be inserted into the database
Stone [S], on Friday, March 11, 2005 at 01:52 (-0800) made these
points:
S Just one. :)
S Your expressions all say \d instead of \d? for the second digit in
S each set, while the simple one correctly has \d?. So your
S expressions had an unfair advantage and as a result finish faster.
right,
Jeff 'japhy' Pinyan [EMAIL PROTECTED] 10/03/2005 11:03:57 am
You can release a module in the same hierarchy.
Time::Period::Extended,
for example.
Would this mean that I make a new file, Time/Period/Extended.pm,
package Time::Period::Extended, which just does a use Time::Period and
then lists
Hi,
I need to modify some existing code. The below line checks a file I'm reading
in and does a search/replace based on the match. Currently I'm looking for...
if (/0 set/) { ...etc.
Because the 00 can change to different numbers (but always 6 figures
which could include a period)
FlashMX wrote:
Hi,
I need to modify some existing code. The below line checks a file I'm reading
in and does a search/replace based on the match. Currently I'm looking for...
if (/0 set/) { ...etc.
Because the 00 can change to different numbers (but always 6 figures
which could include a
Cool...that worked...thanks
I forgot to mention that one the match is found I do a search and replace
if (/[0-9.]{6} setgray/) {
s/.9 set/-50.2 v \n.9 set/;
This is the issue. I need to grab the match number (whatever it is) and add
it into the s/
Because it's up-side down.
Why is that?
It makes replies harder to read.
Why not?
Please don't top-post.
(Sherm Pendley, MacOSX List)
FlashMX wrote:
Cool...that worked...thanks
I forgot to mention that one the match is found I do a search and replace
if (/[0-9.]{6} setgray/) {
I am running ActivePerl 5.8.6 on Windows XP.
I am unable to execute a statement like -- perl -e 'perl code' --
I always get this response: Can't find string terminator ' anywhere before
EOF at -e line 1.
Does not matter if I use (', , or `) .. same response expect it can't find
the string
Like:
perl -e print \Hello World!\n\;
alfred,
renard wrote:
I am running ActivePerl 5.8.6 on Windows XP.
I am unable to execute a statement like -- perl -e 'perl code' --
I always get this response: Can't find string terminator ' anywhere
before EOF at -e line 1.
Does not matter if I use (', ,
FlashMX wrote:
Hi,
Hello,
I need to modify some existing code. The below line checks a file I'm
reading in and does a search/replace based on the match. Currently
I'm looking for...
if (/0 set/) { ...etc.
Because the 00 can change to different numbers (but always 6
figures which could
I am unable to execute a statement like -- perl -e 'perl code' --
I always get this response: Can't find string terminator '
anywhere before
EOF at -e line 1.
From the command line, use to quote your code and qq() or q() as
quotes inside your code:
c:\perl -eprint qq(Hello\n)
--
To
John W. Krahn wrote:
FlashMX wrote:
I need to modify some existing code. The below line checks a file I'm
reading in and does a search/replace based on the match. Currently
I'm looking for...
if (/0 set/) { ...etc.
Because the 00 can change to different numbers (but always 6
figures which
FlashMX wrote:
Cool...that worked...thanks
I forgot to mention that one the match is found I do a search and replace
if (/[0-9.]{6} setgray/) {
s/.9 set/-50.2 v \n.9 set/;
This is the issue. I need to grab the match number (whatever it is) and
On Fri, 11 Mar 2005 07:53:30 -0800, John W. Krahn wrote:
John W. Krahn wrote:
FlashMX wrote:
I need to modify some existing code. The below line checks a file I'm
reading in and does a search/replace based on the match. Currently
I'm looking for...
if (/0 set/) { ...etc.
Because the
FlashMX wrote:
Cool...that worked...thanks
I forgot to mention that one the match is found I do a search and replace
if (/[0-9.]{6} setgray/) {
s/.9 set/-50.2 v \n.9 set/;
This is the issue. I need to grab the match number (whatever it is) and add
it into
On Fri, 11 Mar 2005 10:57:19 -0500, FlashMX wrote:
On Fri, 11 Mar 2005 07:53:30 -0800, John W. Krahn wrote:
John W. Krahn wrote:
FlashMX wrote:
I need to modify some existing code. The below line checks a file I'm
reading in and does a search/replace based on the match. Currently
I'm
Why does this syntax not work? The $1 does not come out.
if (/([0-9.]{6}) set/) {
s/$1 set/\n-50.2 v \n$1 set/;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
if (/([0-9.]{6}) set/) {
s/$1 set/\n-50.2 v \n$1 set/;
You need to escape the period or it will match any character but
newline. As it is right now you'll match .FANTA, which isn't what
you want.
Why does this syntax not work? The $1 does not come out.
You
Hi,
I am running perl 5.8.6 on z/OS unix. I am doing these :
$u = unpackU0U, \x8a\x73;
print \n\$u : $u;
$p = pack(U0U, $u);
print \n\$p : $p;
This intuitively suggests that $p should be set to the chars \x8a and \x73.
But that isnt the case. Instead I get the char \x59.
Alternately,
If I
Stone wrote:
if (/([0-9.]{6}) set/) {
s/$1 set/\n-50.2 v \n$1 set/;
You need to escape the period or it will match any character but
newline. As it is right now you'll match .FANTA, which isn't what
you want.
A character class is not the same as a regular
- Original Message -
From: renard [EMAIL PROTECTED]
To: Perl Beginners List beginners@perl.org
Sent: Friday, March 11, 2005 9:23 AM
Subject: Executing perl code on the command line
I am running ActivePerl 5.8.6 on Windows XP.
I am unable to execute a statement like -- perl -e 'perl
Hi,
I need to parse this string: 2005-03-11 13:49:41.19
to just get the hour and minute.
my program has:
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
{
print(Hour:Minute = $4:$5\n);
}
This is breaking. If anyone can refine this, that would be great.
thanks,
radhika
--
radhika wrote:
Hi,
I need to parse this string: 2005-03-11 13:49:41.19
to just get the hour and minute.
my program has:
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
I guess it should have been =~ instead of =
{
print(Hour:Minute = $4:$5\n);
}
if ( $string =~
radhika wrote:
Hi,
I need to parse this string: 2005-03-11 13:49:41.19
to just get the hour and minute.
my program has:
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
{
print(Hour:Minute = $4:$5\n);
}
I doubt that you are running under strict and warnings.
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
{
print(Hour:Minute = $4:$5\n);
}
You have an unmatched [ in your expression.
(\w+) doesn't match the . if that matters to you.
This is breaking. If anyone can refine this, that would be great.
thanks,
radhika
--
I am running perl 5.8.6 on z/OS unix. I am doing these :
$u = unpackU0U, \x8a\x73;
print \n\$u : $u;
$p = pack(U0U, $u);
print \n\$p : $p;
Are you running with strict and warnings turned on? Because I'm
getting Malformed UTF-8 character messages running this:
#!/usr/bin/perl
use
Is there a quick way to initialize a number of variables at once? Something
like
my ($var1, $var2, $var3);
but instead of having undef in all of them, let's say I want to have 1 in
each. Any takers?
Peter
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
Peter Rabbitson wrote:
Is there a quick way to initialize a number of variables at once?
Something like
my ($var1, $var2, $var3);
my ($var1, $var2, $var3) = ( 1,1,1 );
Wags ;)
but instead of having undef in all of them, let's say I want to have
1 in each. Any takers?
Peter
On Fri, 11 Mar 2005, Peter Rabbitson wrote:
Is there a quick way to initialize a number of variables at once? Something
like
my ($var1, $var2, $var3);
but instead of having undef in all of them, let's say I want to have 1 in
each. Any takers?
Yes.
my ($var1, $var2, $var3) = (1,
On Fri, Mar 11, 2005 at 12:45:10PM -0800, Wagner, David --- Senior Programmer
Analyst --- WGO wrote:
Peter Rabbitson wrote:
Is there a quick way to initialize a number of variables at once?
Something like
my ($var1, $var2, $var3);
my ($var1, $var2, $var3) = ( 1,1,1 );
Wags ;)
On Fri, 2005-03-11 at 10:25 +, SG Edwards wrote:
Hi,
I have a program that extracts variables from a list of flatfiles and I want
to
insert these variables into a PostreSQL database.
I was planning on creating a CSV file with a line allocated for each file
which
can then be
Peter Rabbitson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Fri, Mar 11, 2005 at 12:45:10PM -0800, Wagner, David --- Senior
Programmer Analyst --- WGO wrote:
Peter Rabbitson wrote:
Is there a quick way to initialize a number of variables at once?
Something like
my
All,
Here is my code:
use strict;
use warnings;
my $dev = qw/original1/;
my $dev1 = qw/clinical1/;
my $fout = qq(/usr/local/log/fuji.out);
open (OUT, +$fout) || die unable to open file: $fout $!;
open (FOO, samcmd a $dev 2\1 | ) || die unable to open pipe...
$!;
while
Todd W [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Peter Rabbitson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Fri, Mar 11, 2005 at 12:45:10PM -0800, Wagner, David --- Senior
Programmer Analyst --- WGO wrote:
Peter Rabbitson wrote:
Is there a quick way
On Fri, Mar 11, 2005 at 04:09:12PM -0500, Todd W wrote:
Peter Rabbitson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Fri, Mar 11, 2005 at 12:45:10PM -0800, Wagner, David --- Senior
Programmer Analyst --- WGO wrote:
Peter Rabbitson wrote:
Is there a quick way to
[EMAIL PROTECTED] wrote:
All,
Here is my code:
use strict;
use warnings;
my $dev = qw/original1/;
my $dev1 = qw/clinical1/;
my $fout = qq(/usr/local/log/fuji.out);
open (OUT, +$fout) || die unable to open file: $fout $!;
open (FOO, samcmd a $dev 2\1 | ) || die unable
[EMAIL PROTECTED] wrote:
All,
Here is my code:
use strict;
use warnings;
my $dev = qw/original1/;
my $dev1 = qw/clinical1/;
my $fout = qq(/usr/local/log/fuji.out);
open (OUT, +$fout) || die unable to open file: $fout $!;
open (FOO, samcmd a $dev 2\1 | ) || die unable
Wags,
come on you did not answer all my questions??? What about
I took away the + from the print and I had some errors, why is the +
infront of the split needed in Perl?
I looked in my programming perl and could not find it/.
The reason I want to use split is b/c these numbers change
radhika wrote:
Hi,
Hello,
I need to parse this string: 2005-03-11 13:49:41.19
to just get the hour and minute.
my program has:
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
{
print(Hour:Minute = $4:$5\n);
}
This is breaking. If anyone can refine this, that would be great.
[EMAIL PROTECTED] wrote:
Wags,
come on you did not answer all my questions??? What about
I answered what I could. So is this what you want:
62622 62622
62535 87
where the code looks like:
#!perl
use strict;
use warnings;
my $diff=0;
my $MyMult = 1;
my $MyId;
while (DATA) {
I am writing a script to list out a directory's contents, showing the
number of days since modified. The problem I am having is that the
script doesn't list out the modified time unless I change to the
directory being listed. If I change to the directory I want to list,
then all works okay. Is
Bret Goodfellow wrote:
I am writing a script to list out a directory's contents, showing the
number of days since modified. The problem I am having is that the
script doesn't list out the modified time unless I change to the
directory being listed. If I change to the directory I want to
Yes Wags the end result is 87, but I want to just take these two numbers
and subtract then as opposed to using the * operator . I appreciate you
efforts, but there's got to be an easier and more closely related answer to
my original code with +(split)[2].
Does anyone know the answer
my ($var1, $var2, $var3... arbitrary number of vars) = 1,
which obviously doesn't work, but I hoped it's only due to my lack of syntax
knowledge.
my $var1 = my $var2 = my $var3 = 1;
works. Still ugly?
alfred
Peter Rabbitson wrote:
On Fri, Mar 11, 2005 at 04:09:12PM -0500, Todd W wrote:
Peter
Bret Goodfellow wrote:
I am writing a script to list out a directory's contents, showing the
number of days since modified. The problem I am having is that the
script doesn't list out the modified time unless I change to the
directory being listed. If I change to the directory I want to list,
[ Please TRIM your posts! ]
[EMAIL PROTECTED] wrote:
Does anyone know the answer to:
I took away the + from the print and I had some errors, why is the +
infront of the split needed in Perl?
I looked in my programming perl and could not find it.
perldoc -f print
John
--
use Perl;
ok in perldoc print it states:
If FILEHANDLE is a variable and the next token is a term, it may me
intrepreted as an operator unless you interpose a + .
so in the code :
while (FOO) {
code
...code
print +(split)[2], $, ;
}
FOO is my filehandle and it is considered a
The File::Find::name didn't seem to make any difference. I still have
to be in the directory that I want to search. Hmmm.
-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]
Sent: Friday, March 11, 2005 3:13 PM
To: Bret Goodfellow;
[EMAIL PROTECTED] wrote:
All,
Hello,
Here is my code:
use strict;
use warnings;
my $dev = qw/original1/;
my $dev1 = qw/clinical1/;
Why are you creating a list and then assigning it to a scalar?
my $fout = qq(/usr/local/log/fuji.out);
Why use double quotes on a string that has nothing to
Bret Goodfellow wrote:
The File::Find::name didn't seem to make any difference. I still have
to be in the directory that I want to search. Hmmm.
-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]
Sent: Friday, March 11, 2005 3:13
[EMAIL PROTECTED] wrote:
John W. Krahn
[ Please TRIM your posts! ]
[EMAIL PROTECTED] wrote:
Does anyone know the answer to:
I took away the + from the print and I had some errors, why is the +
infront of the split needed in Perl?
I looked
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
Bret Goodfellow wrote:
From: Wagner, David --- Senior Programmer Analyst --- WGO
Bret Goodfellow wrote:
I am writing a script to list out a directory's contents, showing the
number of days since modified. The problem I am having is that
John W. Krahn wrote:
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
Bret Goodfellow wrote:
From: Wagner, David --- Senior Programmer Analyst --- WGO
Bret Goodfellow wrote:
I am writing a script to list out a directory's contents, showing
the number of days since modified.
I've been writing a failry complicated data collector with structures as
deep as 7 levels, and everything worked very nice for me, until I started
cleaning the subroutine interfaces, so they would pass references back and
forth instead of working on global vars. The following is a sample code:
Peter Rabbitson wrote:
I've been writing a failry complicated data collector with structures
as deep as 7 levels, and everything worked very nice for me, until I
started cleaning the subroutine interfaces, so they would pass
references back and forth instead of working on global vars. The
On Fri, Mar 11, 2005 at 04:42:14PM -0800, Wagner, David --- Senior Programmer
Analyst --- WGO wrote:
Peter Rabbitson wrote:
I've been writing a failry complicated data collector with structures
as deep as 7 levels, and everything worked very nice for me, until I
started cleaning the
David == David [EMAIL PROTECTED] writes:
David /\s(\d+)/,
David $diff += $1 * $MyMult;
Never never never NEVER NEVER use $1 without testing whether
the match worked or not.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Peter == Peter Rabbitson [EMAIL PROTECTED] writes:
Peter Is there a quick way to initialize a number of variables at once?
Something
Peter like
Peter my ($var1, $var2, $var3);
Peter but instead of having undef in all of them, let's say I want to have 1
in
Peter each. Any takers?
First, I
ok perl people... I chnaged my code from
use strict;
use warnings;
my $dev = qw/original1/;
my $dev1 = qw/clinical1/;
my $fout = qq(/usr/local/log/fuji.out);
open (OUT, +$fout) || die unable to open file: $fout $!;
open (FOO, samcmd a $dev 2\1 | ) || die unable to open
73 matches
Mail list logo