Maybe I should tell you what fixed it:
The "param" was a string so enclosed it in single quotes.
Thanks!
-Original Message-
From: Tielman Koekemoer (TNE) [mailto:[EMAIL PROTECTED]
Sent: 06 May 2005 02:33 PM
To: [EMAIL PROTECTED]; beginners@perl.org
Subject: RE: Calling a
Thanks Prasanna, that fixed it.
-Original Message-
From: Prasanna Kothari [mailto:[EMAIL PROTECTED]
Sent: 06 May 2005 02:26 PM
To: beginners@perl.org
Cc: Tielman Koekemoer (TNE)
Subject: Re: Calling a subroutine - strict very strict
what is "param".?
If it's a variable, a
what is "param".?
If it's a variable, and not declared, qualify it using "my or local".
Else, if it's a string that you want pass to the function, use single
quotes.
-Prasanna
Tielman Koekemoer (TNE) wrote:
Hi All,
I apologise for the newbie question straight off - I don't have my
Camel book with
Oops, hit send by mistake. This problem all seems to be about mistakes...
Thanks to all who replied.
> You have three different hashes in use. Look:
I did indeed have 3 hash tables... Duh (Must have been Friday afternoon).
The central problem was calling '&{${$date_format{$format}}{now}}()'
i
| PM |
| ||
|-+>
>--|
|
|
| To: [EMAIL PROTECTED]
|
| cc:
|
|
Peter,
#!/usr/bin/perl -w
use strict;
my %date_formats = (
ccyymmdd => { now => sub {
my @arr = localtime();
print 'Year ', 1900 + $arr[5] . ' Month '. sprintf("%02d",$arr[4] + 1)
. ' Day ' . sprintf("%02d",$arr[3]);
}
} );
& { $date_formats{ccyymmdd}{now} };
Same output as previous
Peter
I saw Jenda's note and I suggest the code needs simplification.
> P.S. you can see where I comment out the ccyymmdd_now function. That
> approach works, but is not what I'm shooting for.
>
> %date_formats = (
> # "ccyymmdd" => {now => \ccyymmdd_now()},
> "ccyymmdd" => {now => s
Peter Farrar wrote:
> Hi All,
>
> I swear I've called subroutines this way before, but I can't find any
> examples.
> In this case, I'm looking to build some time/date functions.
> Regardless of what the actual code is supposed to do, the calling of
> subroutines as elements of a hash is causing me
From: "John W. Krahn" <[EMAIL PROTECTED]>
> Peter Farrar wrote:
> > I swear I've called subroutines this way before, but I can't find
> > any examples. In this case, I'm looking to build some time/date
> > functions. Regardless of what the actual code is supposed to do,
> > the calling of subrouti
Peter Farrar wrote:
>
> Hi All,
>
> I swear I've called subroutines this way before, but I can't find any
> examples.
> In this case, I'm looking to build some time/date functions. Regardless of
> what the actual code is supposed to do, the calling of subroutines as
> elements of a hash is causi
--- Chris Zampese <[EMAIL PROTECTED]> wrote:
> How do I call a subroutine in a cgi script. I thought that it was just
>
> subroutine_name();
>
> but that does not seem to be working for me?
>
> You guys are great. Thanks for your help (both from answering my questions, and
>from ans
11 matches
Mail list logo