foreach $sub (@list_of_subs) {
{$sub}; ##-- this is the part I am stuck on. This doesn't work
}
I don't know the answer to your question; I'm also interested in what others
have to say. However, I have to wonder if Perl is looking at {$sub} and
interpretting it as a command to
here is two examples of that work for me
require pl/require.pl;
$functiontocall ='RequireAll';
$functiontocall-();
--
-
my $alias = home|SplitInput,LoadVariables,DirectUser,;
my ($name, $subs) = split(/\|/,
24, 2002 11:11
To: Zielfelder, Robert
Cc: [EMAIL PROTECTED]
Subject: RE: Using a variable name to invoke a subroutine
foreach $sub (@list_of_subs) {
{$sub}; ##-- this is the part I am stuck on. This doesn't work
}
I don't know the answer to your question; I'm also interested in what
efficient if I can. Any insight would be
appreciated.
if the order of executing your subroutine is NOT important, use a hash:
#!/usr/bin/perl -w
use strict;
my %hash = ( sub1 = [\sub1,1,2], sub2 = [\sub2,3,4] );
while(my($name,$sub) = each %hash){
my @subs = @{$sub};
print calling
Robert Zielfelder wrote:
I have a script that uses an array to determine weather or not a subroutine
needs to be run or not. I want to be able do a foreach on the array and
invoke the subroutine using the control variable. The names of the
subroutines are the same as the items inside
Hello all,
I currently currently passing a subroutine one scalar value and two arrays.
Both array's work before and after the function call. However only one of
hte arrays works within the subroutine.
example code:
print @array1; //this works
print @array2; //this works
subroutine
Shaun Bramley wrote:
Hello all,
Hello,
I currently currently passing a subroutine one scalar value and two arrays.
Both array's work before and after the function call. However only one of
hte arrays works within the subroutine.
example code:
print @array1; //this works
print
Hi, Shaun, :)
I currently currently passing a subroutine one scalar value and two
arrays.
Hmm. This is not what you're doing in the example code. In the
example code, this line:
subroutine($a, @array1, @array2);
says Call subroutine with arguments of $a, all of the entries in
@array1
When you pass an array to a subroutine in Perl, it takes the arguments and
passes a list, I _think_ even if you use that format. It would be much
better, IMHO to use references. Something like:
### SCRIPT #
use strict;#Get in the habit of using
thanks,
i ended up getting what i wanted with references:
sub1(\@array,$var);
sub sub1() {
my ($ref, $var) = @_;
my @data = @$ref;
...
}
--- drieux [EMAIL PROTECTED] wrote:
On Friday, Sep 13, 2002, at 16:29 US/Pacific,
Anthony E. wrote:
[..]
for example, i tried this, but it
.
Compared to the goes image, the lat/lon pairs are stored by column first,
then row; i.e. all the elements in row 1 are stored, then row 2 etc until
the bottom of the image.
The following is a fortran subroutine that can be used to read
the goes.nav file
John Cichy wrote:
Thank you very much, you confirmed that I was at least on the right track
with what I was doing. The numbers are still not coming out correctly (at
least not what I was expecting). This file seems to be geared towards a
sun system, could this be effecting my results, would
John Cichy wrote:
Thank you very much, you confirmed that I was at least on the right track
with what I was doing. The numbers are still not coming out correctly (at
least not what I was expecting). This file seems to be geared towards a
sun system, could this be effecting my results, would
until
the bottom of the image.
The following is a fortran subroutine that can be used to read
the goes.nav file:
subroutine getnav(lat,lon)
c
c* This routine reads goes.nav files
.
The following is a fortran subroutine that can be used to read
the goes.nav file:
subroutine getnav(lat,lon)
c
c* This routine reads goes.nav files with a maximum size of *
c* 2000 pixels
, but you might want to try
something
like this:
$q = new CGI;
my $con = $q-param('con');
Soheil
-Original Message-
From: Kyle Babich [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 1:37 PM
To: beginners-cgi
Subject: Undefined subroutine main::param called
Is it possible to pass a hash into a subroutine to be used as a local
variable? I'm trying to do this:
($rows, %results) = Select($mytable, $where_f1, $compare1, $where_v1,
@quick_check, %field_values);
sub Select {
my($db_table, $where_field, $comparison, $where_value,@fieldlist,
%values
The last item that you pass to a perl subroutine can be a array or a
hash, but none but the last, since oerl will greedy-match your arrays
when you assign them in your subroutine. The way around this is to pass
them in by reference:
($rows, %results) = Select($mytable, $where_f1, $compare1
On Jul 11, rory oconnor said:
Is it possible to pass a hash into a subroutine to be used as a local
variable? I'm trying to do this:
The arguments sent to a function are flattened into one big list. There's
no way to know where your array ends and your hash begins. Furthermore,
doing
$x
From: George Schlossnagle [EMAIL PROTECTED]
The last item that you pass to a perl subroutine can be a array or a
hash, but none but the last, since oerl will greedy-match your arrays
when you assign them in your subroutine. The way around this is to
pass them in by reference:
($rows
Hello all,
What I want to do is simple - if an error occurs on my previous command
(in this case, making an FTP connection via Net::FTP), I want to send
the value of $@ to a subroutine which sends an e-mail containing the
value of $@ in the body. However, it is clear that I don't understand
. Singh wrote:
Hello all,
What I want to do is simple - if an error occurs on my previous command
(in this case, making an FTP connection via Net::FTP), I want to send
the value of $@ to a subroutine which sends an e-mail containing the
value of $@ in the body. However, it is clear that I
into the sub.
Wags ;) ps others may be to make clearer.
-Original Message-
From: Ian Zapczynski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 03, 2002 12:34
Cc: [EMAIL PROTECTED]
Subject: Re: How to pass the value of $@ to a subroutine
Thanks! Changing:
my $message = @_;
to:
my ($message
Thanks! Changing:
my $message = @_;
to:
my ($message) = @_;
did put the correct value in the string.
If anyone cares to explain the difference between the code I had and the code
Shishir suggested so I can understand why this makes a difference, I'm all
ears!
@_ is an array.
You were
On Wednesday, June 26, 2002, at 07:38 , Kipp, James wrote:
so which is better? to make a lib file with functions or a modular/OOP pm
file ?
technically this is a false dichotomy. you can not tell
if the file BAR.pm is an OO style Perl Module, or merely
a Functional/Proceduralist style Perl
so far all my libs (well there ain't much ) are all OO pm files.
There is what I would call the 'dataLess' OO solution,
what is known as a 'utility class' - where one has only
a stack of methods that one wishes to have in a 'nameSpaceSafe'
environment - so that you know that
my
On Sunday, June 23, 2002, at 10:11 , Timothy Johnson wrote:
[..]
If you put the module above in a file called UC.pm in the site/lib/Tim
folder, you will have a module with your reusable subroutine. The only
weird part: Don't forget that the last line should be just a '1'. Just
put
a use
hi all of you,
i have a multiple perl files that use the same subroutines, the only way
i know to handle this - i know its not so cleaver - is to copy paste the
portion of the subroutine in all perl files i want to use it, what is the
more clever way?
thx v. much
--
Hytham Shehab
I'm not sure I understand what you're asking. Please clarify. -Jimmy James
Hytham Shehab wrote:
hi all of you,
i have a multiple perl files that use the same subroutines, the only way
i know to handle this - i know its not so cleaver - is to copy paste the
portion of the subroutine
what you're asking. Please clarify. -Jimmy James
Hytham Shehab wrote:
hi all of you,
i have a multiple perl files that use the same subroutines, the only way
i know to handle this - i know its not so cleaver - is to copy paste the
portion of the subroutine in all perl files i want
i think that writing a module is not my answere, i think it is a huge
complicated answere for a simple question.
all what i want is simply put all my used subroutines in a seperate files,
then call the subroutine from that file whenever i want to use the
subroutine, am i clear now?
no redundency
the subroutine from that file whenever i want to use the
subroutine, am i clear now?
no redundency is my only target, thats it...
thx v. much, specially Lundeen and drieux
--
Hytham Shehab
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED
in a seperate files,
then call the subroutine from that file whenever i want to use the
subroutine, am i clear now?
Ok, let start out simple then - we'll get you to h2xs and
the rest of that as they become more useful.
you need three basic things:
a) a place to put them that you will always
;
And the freaking code STILL works.
all what i want is simply put all my used subroutines in a seperate files,
then call the subroutine from that file whenever i want to use the
subroutine, am i clear now?
[..]
Well I hope this will help you:
http://www.wetware.com/drieux/pbl/perlTrick/subStuff
= $_[0];
foreach my $element(@{$ref}){
$element = uc($element);
}
}
1
##
If you put the module above in a file called UC.pm in the site/lib/Tim
folder, you will have a module with your reusable subroutine. The only
weird part: Don't forget that the last line should be just
Jun 2002 08:23:33 -0500
Janek,
Wouldn't it print:
foo:
foo:A B C
Also, I believe that you must declare the subroutine before you
are allowed
to reference it without the . Am I right about that?
-Original Message-
From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June
Janek,
Wouldn't it print:
foo:
foo:A B C
Also, I believe that you must declare the subroutine before you are allowed
to reference it without the . Am I right about that?
-Original Message-
From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 5:10 AM
]]
Sent: Wednesday, June 05, 2002 8:30 AM
To: 'Octavian Rasnita'; [EMAIL PROTECTED]
Subject: RE: subroutine or subroutine
-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: subroutine or subroutine
No, the subroutinue body can occur before or after the invokation point with
or without the .
joel
-Original Message-
From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
Sent: 06 June 2002 14:24
To: 'Janek Schleicher'; [EMAIL PROTECTED]
Subject: RE: subroutine or subroutine
Janek
Begin forwarded message:
From: drieux [EMAIL PROTECTED]
Date: Thu Jun 06, 2002 07:38:29 US/Pacific
To: begin begin [EMAIL PROTECTED]
Subject: notBob clarifies the Bob was Re: subroutine or subroutine
On Thursday, June 6, 2002, at 06:31 , Camilo Gonzalez wrote:
[..]
Since
Bob Showalter wrote at Wed, 05 Jun 2002 15:30:29 +0200:
3. Don't use the foo or foo(args) calling styles.
Allthough I would miss it a little bit.
I find the foo style useful when implementing a little polymorphic subroutine.
Example:
sub foo {
/NUMERIC/ _foo_numeric
On Thursday, June 6, 2002, at 06:31 , Camilo Gonzalez wrote:
[..]
Since this is a list for newbies, can you please be a bit more specific
why
you are opposed to those things you list. I'm quite fond of using the foo
or foo(args) calling styles. Is this just a personal preference?
[..]
Bob
Yes, you can call subroutines either way, with or without the .
The only case when the subroutine must be prefixed with an
ampersand is, I believe, when you're assigning a reference
variable, eg:
$reference_x = \subroutine_y;
But that's another story.
Kevin
-- Original Message
Kevin Christopher wrote at Wed, 05 Jun 2002 04:58:38 +0200:
Yes, you can call subroutines either way, with or without the . The only case
when the
subroutine must be prefixed with an ampersand is, I believe, when you're assigning a
reference
variable, eg:
$reference_x = \subroutine_y
-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: subroutine or subroutine
Hi all,
I've seen some subroutines are ran without the sign in front of the
subroutine name, like
To: 'Octavian Rasnita'; [EMAIL PROTECTED]
Subject: RE: subroutine or subroutine
Here are my recommendations for new code (others may want to
debate these):
1. Always use strict;
2. Don't use prototypes.
3. Don't use the foo or foo(args) calling styles.
4. To call a sub with no arguments
Hi all,
I've seen some subroutines are ran without the sign in front of the
subroutine name, like:
subroutine_name;
instead of
subroutine_name;
Is it the same thing or there is a difference?
Thank you.
Teddy,
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
Hello,
I have a subroutine where I want to pass some paramaters to it, but assign
default ones if a paramater is not passed. This is similar to CGI.
mySub( -param1='my value', -param3='value' ); # -param2 would get a default
value
The problem I am running
-Original Message-
From: Robert Thompson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 3:38 PM
To: [EMAIL PROTECTED]
Subject: Passing array to subroutine problem
Hello,
I have a subroutine where I want to pass some
paramaters to it, but assign default ones
Hi,
I'm having a very frustrating time with a small test program I'm trying to
write. I'm using ActivePerl 5. I'm sure the answer is simple and I'll kick
myself when someone clarifies the matter, but here goes anyway:
The error message is:
Undefined subroutine main::html_chars called at test2
[EMAIL PROTECTED] wrote:
Hi,
I'm having a very frustrating time with a small test program I'm trying to
write. I'm using ActivePerl 5. I'm sure the answer is simple and I'll kick
myself when someone clarifies the matter, but here goes anyway:
The error message is:
Undefined subroutine
Tagore Smith wrote at Wed, 29 May 2002 06:13:25 +0200:
...
in pseudocode:
my @failed;
if (field fails validation){
push @failed, $fieldname;
}
}
etc.
Or in another pseudocode:
my @failed = grep {field fails validation} @fields;
Cheerio,
Janek
--
To unsubscribe, e-mail:
Thanks for the suggestions guys.
- Original Message -
From: Leila Lappin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 11:55 PM
Subject: Is there a good Perl way for a validation subroutine?
Hello all,
I need to write a subroutine that validates several fields
Hello all,
I need to write a subroutine that validates several fields and returns one summary
field containing names of what failed. I was thinking of concatenating names of all
fields that failed and return that string from the subroutine. Then check the string
(return value) and if it's
Leila Lappin wrote:
Hello all,
I need to write a subroutine that validates several fields and returns one
summary field containing names of what failed. I was thinking of
concatenating names of all fields that failed and return that string from
the subroutine. Then check the string (return
HI,
Will someone please tell me how to send a filehandle to
a subroutine, with the syntax.
open(FILE, file.fil);
$foo = FILE
subro( )-How do I send down FILE
sub subro {
my = @_; - How do I pick it up?
thank you
--
To unsubscribe, e-mail: [EMAIL PROTECTED
Here's a nice little article on that:
http://www.rocketaware.com/perl/perlfaq5/How_can_I_make_a_filehandle_loca.ht
m
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/7/02 8:36 AM
Subject: FILE to subroutine
HI,
Will someone please tell me how to send
Oops! Looks like I forgot the 'm'. That should be
http://www.rocketaware.com/perl/perlfaq5/How_can_I_make_a_filehandle_loc
a.htm
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/7/02 8:58 AM
Subject: FILE to subroutine
Sorry This was the message that came up
by the email reader.
unfortunately, the same thing happened on the second try. now with 'a.htm'
..
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/7/02 8:58 AM
Subject: FILE to subroutine
Sorry This was the message that came up.
for the URL:
http
on Tue, 07 May 2002 15:58:50 GMT, wrote:
The requested URL /perl/perlfaq5/How_can_I_make_a_filehandle_loca.ht
was not found on this server.
Can anyone get the text or provide the answer on paper?
If you type
perldoc -q filehandle local
at a command prompt, the text will
on Thu, 18 Apr 2002 12:56:43 GMT, [EMAIL PROTECTED] (Richard Noel Fell)
wrote:
However, I do not understand your
comments about the return value of map. Does not map return a
reference to an anonymous arrar, not a hash?
'map' returns a *list*. This list can be coerced into an array or into
Felix -
Thanks for the very clear explanation.
Dick
Felix Geerinckx wrote:
on Thu, 18 Apr 2002 12:56:43 GMT, [EMAIL PROTECTED] (Richard Noel Fell)
wrote:
However, I do not understand your
comments about the return value of map. Does not map return a
reference to an
On Thursday, April 18, 2002, at 06:05 , Felix Geerinckx wrote:
on Thu, 18 Apr 2002 12:56:43 GMT, [EMAIL PROTECTED] (Richard Noel Fell)
wrote:
However, I do not understand your
comments about the return value of map. Does not map return a
reference to an anonymous arrar, not a hash?
on Thu, 18 Apr 2002 18:07:38 GMT, Drieux wrote:
hence
map {[ 'cascade', '~'.$_]} @sub_directories;
as the last line of the sub should have returned a 'list'
back to the caller just as the
sub foo { qw/ 1 2 3 4 5 6 7 8 9 / } ;
would return a 'list' ???
Yes
or should
On Thursday, April 18, 2002, at 11:21 , Felix Geerinckx wrote:
[..]
Personally, however, I prefer an explicit 'return' statement, as in
return map { ($_ = 1) }, @array;
(The () are optional).
[..]
Ok, I can go there... so my test code shows me
[jeeves:~/tmp/perl/misc] drieux% perl
. I get an error message :
Not an ARRAY reference at
/usr/local/ActivePerl-5.6/lib/site_perl/5.6.1/i686-linux-thread-multi/Tk/Menu.pm
line 69. The cause of this is the subroutine sub_menu. As I understand
things, the argument to -menuitems must be a reference to an anonymous
array. Am I correct
On Wednesday, April 17, 2002, at 02:09 , richard noel fell wrote:
[..]
sub create_menu_bar
{
my $mb = $MW-Menu();
$MW-configure(-menu=$mb);
opendir DIR, ./ or die cannot open current directory: $!;
my $current_directory = cwd;
my @directories = grep { !/^\.\.?$/ -d
Hi all,
Despite what the documentation says on this topic, I'm unable to have the 8th
parameter of syb_err_handler even after having set syb_show_sql to true:
use DBI;
# ---
# Errors handling
# ---
sub msg_handler_SYB {
print join ( | , @_), \n;
}
$sth =
}
my $_incr_count = sub {++$_count};#create an anonymous subroutine
sub new{
$_incr_count-();#call anonymous subroutine
#
# Instead I could put this code?:
# my $_incr_count = sub {++$_count};
#$_incr_count
in the entire collection?
print The number of CDs is ,CD::Music-get_count, \n;
package CD::Music;
use strict;
{
my $_count = 0;
sub get_count {$_count}
my $_incr_count = sub {++$_count};#create an anonymous subroutine
sub new
,
5.0);
# How many CDs in the entire collection?
print The number of CDs is ,CD::Music-get_count, \n;
package CD::Music;
use strict;
{
my $_count = 0;
sub get_count {$_count}
my $_incr_count = sub {++$_count};#create an anonymous subroutine
Hi all,
I am fighting with the following short test script, and I can make it work
only if I use a subroutine.
I want to make it work without a subroutine.
The script works as it is, but if I remove the line that runs the
subroutine, and the
first and last lines of the subroutine (sub up
an anonymous subroutine
$_incr_count-();# it works if I call it here
sub new{
$_incr_count-();#call the anonymous subroutine
#this line above causes the error below
#Isn't this where the anonymous subroutine should go?
#my $_incr_count = sub {++$_count
Perl* by Conway. (Error message is below.)
package CD::Music;
#use strict; # turn this off for testing purposes
{
my $_count = 0;
sub get_count {$_count}
my $_incr_count = sub {++$_count};#create an anonymous subroutine
$_incr_count-();# it works if I
1. I want to be able to create a hostname = user hash table
like this
%hosts = (
sun1 = bobby,
sun2 + ronald,
)
and a scalar like this
$hostname = qx(/usr/ucb/hostname);
2. I want to be able to build a simple sub like this
sub getname {
print $getname{$hostname};
On Mar 25, [EMAIL PROTECTED] said:
and a scalar like this
$hostname = qx(/usr/ucb/hostname);
You'll want to chomp() $hostname! Output from the /usr/ucb/hostname
command probably has a newline at the end of it; you'll need to remove it.
2. I want to be able to build a simple sub like this
Hi all,
As you can see, I am a newbie, and I don't have the time to write this from
my own, so, I gotta ask.
I need a sobroutine to append a string passed as parameter to a file. And
this sobroutine has to lock and unlock the file, and wait if the file is
locked when it tries to write.
This
Rafael Cotta wrote:
I need a sobroutine to append a string passed as parameter to a file. And
this sobroutine has to lock and unlock the file, and wait if the file is
locked when it tries to write.
This may be a very simple thing. Could someone give me a sample?
have you tried the faq?
Greetings everyone,
I have a script serving pages on our website, and
every now and then it gives me an Internal Error
and the logs say:
[Thu Mar 7 15:19:33 2002] [error] Undefined
subroutine pollstar::singleadvert called at
/home/pollstar/tour/newsearchall.pl line 1026
Greetings everyone,
I have a script serving pages on our website, and every now and then it
gives me an Internal Error and the logs say:
[Thu Mar 7 15:19:33 2002] [error] Undefined subroutine
pollstar::singleadvert called at /home/pollstar/tour/newsearchall.pl line
1026.
But the routine
i'm making my own (hopefully informative) error pages for my site. i have defined a
subroutine pr_error which takes the error(s) as input and outputs an HTML page.
how can i make it go to the end of the script ( __END__ ) on those errors (which will
not necessarily be fatal).
for example:
my
W P wrote:
i'm making my own (hopefully informative) error pages for my site. i have defined a
subroutine pr_error which takes the error(s) as input and outputs an HTML page.
how can i make it go to the end of the script ( __END__ ) on those errors (which
will not necessarily be fatal
I was wondering about the shift inside a subroutine.
I have never used it. What is the purpose of it been there?
Thanks in advance,
Nestor :-)
- Original Message -
From: Stephen.Hurley [EMAIL PROTECTED]
To: 'Bruce Ambraal' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday
On Wed, 20 Feb 2002, Nestor Florez wrote:
I was wondering about the shift inside a subroutine.
I have never used it. What is the purpose of it been there?
It pulls off the first element of the array passed to it. Using shift
with no arguments always pulls from @_ -- it returns $_[0
--- Brett W. McCoy [EMAIL PROTECTED] wrote:
On Wed, 20 Feb 2002, Nestor Florez wrote:
I was wondering about the shift inside a subroutine.
I have never used it. What is the purpose of it been there?
It pulls off the first element of the array passed to it. Using shift
On Wed, 20 Feb 2002, Curtis Poe wrote:
Great description with one minor caveat: shift with no arguments will
pull from @ARGV if not used in a subroutine.
Yes, thanks for pointing that out.
-- Brett
http://www.chapelperilous.net
it to an error subroutine.
Here's what I have now:
SNIPPED
sub subscription
{
($passed_ep,$passed_pr$passed_sub,$passed_org,$passed_plat)=shift;
#add error routine to handle if PR/PM doesn't exist -pass to
exception_sub?
`wsub \@ProfileManager:Staging \@Endpoint:$passed_ep`;
`wln \@Endpoint
On Fri, 15 Feb 2002, Paul Farley wrote:
I have an application that I am using a perl script to do pattern matching
and then execute commands specific to that application. I need a way to
handle an error in my script if one of the `cmd blah`; doesn't work and send
it to an error subroutine
it to an error subroutine.
Here's what I have now:
SNIPPED
sub subscription
{
($passed_ep,$passed_pr$passed_sub,$passed_org,$passed_plat)=shift;
#add error routine to handle if PR/PM doesn't exist -pass to
exception_sub?
`wsub \@ProfileManager:Staging \@Endpoint
Is there any way to avoid these warnings if I have multiple libraries
that use strict. BTW, I think all of mine use struct, I think the
vendor's use Strict.
Subroutine bits redefined at c:\iw-home\iw-perl\lib/Strict.pm line 88.
Subroutine import redefined at c:\iw-home\iw-perl\lib/Strict.pm
--- John [EMAIL PROTECTED] wrote:
Is there any way to avoid these warnings if I have
multiple libraries that use strict. BTW, I think all of
mine use strict, I think the vendor's use Strict.
Perl looks for 'strict' and 'Strict' as different modules,
but they install themselves into the same
On Tue, Jan 29, 2002 at 08:55:31PM -0500, [EMAIL PROTECTED] wrote:
$currency1-currency_object_math(\$currency2, '+');
In the above example, currency_object_math recognizes $currency2 as a
simple reference, not a blessed reference.
That's because it is a simple reference. You're
$currency2 is already a reference (to the currency object).
you can just pass it as:
$currency1-currency_object_math($currency2, '+');
On Tue, 29 Jan 2002 [EMAIL PROTECTED] wrote:
$currency1-currency_object_math(\$currency2, '+');
P.S. I'm not currently subscribed to the list,
hi there
im trying to call a subroutine and get it to return some hash table values. however, i
have two problems.
1. it does not work. theres something wrong with my foreach sentence,
but i cant see what it is. however, the commented foreach sentence
do work?
2. the @return_array
On Mon, 28 Jan 2002, Martin A. Hansen wrote:
$extract = qw (en tre ni);
# foreach $number (qw en tre ni) {
foreach $number ($extract) {
ummm... shouldn't this be
forwach $number (@extract) { ?
^ note the @
you're calling the for loop with a
Martin A. Hansen wrote:
hi there
Hello,
im trying to call a subroutine and get it to return some hash table values. however,
i have two problems.
1. it does not work. theres something wrong with my foreach sentence,
but i cant see what it is. however, the commented foreach
hi
im wondering how i can make a subroutine that will return all text lines between
certain marks such as START and STOP:
text file:
START
text
is here
and there
is
a
lot of it
STOP
so i would like to call the subroutine with the arguments START and STOP (because i
may need more starts
Martin A. Hansen wrote:
im wondering how i can make a subroutine that will return all text
lines between certain marks such as START and STOP:
Here's simple way to do it. It uses the '..' operator (see perldoc
perlop for more info about it).
Note that if START and STOP are in the same line
im wondering how i can make a subroutine that will return all text
lines between certain marks such as START and STOP:
text file:
START
text
is here
and there
is
a
lot of it
STOP
so i would like to call the subroutine with the arguments START and
STOP (because i may need more
Michael R. Wolf wrote:
# Readable.
sub total {
my $sum;
foreach my $num (@_) {
$sum += $num;
}
return $sum;
}
# Streamlined
sub total {
my $sum;
$sum += $_ foreach (@_);# $_ implicitly set
} # sum implicitly returned
901 - 1000 of 1063 matches
Mail list logo