Re: subroutine call

2011-12-05 Thread Shlomi Fish
Hello, John. On Sun, 04 Dec 2011 12:46:40 -0800 John W. Krahn jwkr...@shaw.ca wrote: You should assign $marketInfo{$mkt} to a variable, or alternatively do: my ($start, $end) = @{$marketInfo{$mkt}}{qw(start end)}; my $end = $marketInfo{$mkt}-{end}; if( $cell=

Re: subroutine call

2011-12-05 Thread Shlomi Fish
Hi Ganesh, On Mon, 5 Dec 2011 14:16:29 +0530 ganesh vignesh vigneshganes...@gmail.com wrote: stop mail to me The instructions at the bottom of every E-mail read: [QUOTE] To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org

subroutine call

2011-12-04 Thread Chris Stinemetz
I have a program that I am working on improveing. The fist step I have taken is converting it in using the strict pragma. Now when this subroutine call is made I get the following compilation error: Global symbol $cell requires explicit package name at ./evdo.pl line 279. Global symbol $cell

Re: subroutine call

2011-12-04 Thread Uri Guttman
On 12/04/2011 08:40 AM, Chris Stinemetz wrote: I have a program that I am working on improveing. The fist step I have taken is converting it in using the strict pragma. Now when this subroutine call is made I get the following compilation error: Global symbol $cell requires explicit package

Re: subroutine call

2011-12-04 Thread Shlomi Fish
. Now when this subroutine call is made I get the following compilation error: Global symbol $cell requires explicit package name at ./evdo.pl line 279. Global symbol $cell requires explicit package name at ./evdo.pl line 279. I understand lexical scope, but am having a hard time figuring

Re: subroutine call

2011-12-04 Thread Dr.Ruud
On 2011-12-04 18:12, Shlomi Fish wrote: Chris wrote: my $cell = substr($market,0,index($market,_)); print $_ , substr( $_, 0, index $_, _ ), \n for qw/ foo1 foo2_bar foo3_bar_baz /; foo1 foo foo2_bar foo2 foo3_bar_baz foo3 This can be more idiomatically (and more briefly) done

Re: subroutine call

2011-12-04 Thread John W. Krahn
the strict pragma. Now when this subroutine call is made I get the following compilation error: Global symbol $cell requires explicit package name at ./evdo.pl line 279. Global symbol $cell requires explicit package name at ./evdo.pl line 279. I understand lexical scope, but am having a hard time figuring

Sorting from subroutine call

2006-12-02 Thread Sergio Escalada
Hi all! I would like to know if it's possible to make an array sorting with a subroutine call. Usually, a sort is made as, for example: sort {$a = $b} @array; But my intention is something like: sort subroutine_call @array; sub subroutine { $a = $b; } How could I do it? Thanks. Sergio.

Re: Sorting from subroutine call

2006-12-02 Thread W.P.Nijhof
Sergio Escalada wrote: Hi all! I would like to know if it's possible to make an array sorting with a subroutine call. Usually, a sort is made as, for example: sort {$a = $b} @array; But my intention is something like: sort subroutine_call @array; If you really want to call it like

Re: Sorting from subroutine call

2006-12-02 Thread Lawrence Statton XE2/N1GAK
Hi all! I would like to know if it's possible to make an array sorting with a subroutine call. Usually, a sort is made as, for example: sort {$a = $b} @array; But my intention is something like: sort subroutine_call @array; sub subroutine { $a = $b; } How could I do

Re: Sorting from subroutine call

2006-12-02 Thread Rob Dixon
Sergio Escalada wrote: Hi all! I would like to know if it's possible to make an array sorting with a subroutine call. Usually, a sort is made as, for example: sort {$a = $b} @array; But my intention is something like: sort subroutine_call @array; sub subroutine { $a = $b; } How could

Re: Sorting from subroutine call

2006-12-02 Thread Rob Dixon
Sergio Escalada wrote: Hi all! I would like to know if it's possible to make an array sorting with a subroutine call. Usually, a sort is made as, for example: sort {$a = $b} @array; But my intention is something like: sort subroutine_call @array; sub subroutine { $a = $b; } How could

Re: Sorting from subroutine call

2006-12-02 Thread Sergio Escalada
Thanks for replies. The purpouse of this mini-script is to list the rows from a database loaded in memory ($ref_db is the reference to hashtable that cotains the DB). So I want to order the fields by different sort rules, and make the proccess as abstract as it's possible with a subrutine (sub

Re: Sorting from subroutine call

2006-12-02 Thread Bill Jones
On 12/2/06, Sergio Escalada [EMAIL PROTECTED] wrote: The purpouse of this mini-script is to list the rows from a database loaded in memory ($ref_db is the reference to hashtable Another idea - sub sortrows { my $sorted = @_; $sorted = -(($a-{ahash} eq 'x') = ($b-{ahash} eq 'x')) if

Re: Sorting from subroutine call

2006-12-02 Thread Lawrence Statton XE2/N1GAK
The purpouse of this mini-script is to list the rows from a database loaded in memory ($ref_db is the reference to hashtable that cotains the DB). So I want to order the fields by different sort rules, and make the proccess as abstract as it's possible with a subrutine (sub cmpRule). This sub

Re: Sorting from subroutine call

2006-12-02 Thread Mumia W.
On 12/02/2006 06:22 AM, Sergio Escalada wrote: Hi all! I would like to know if it's possible to make an array sorting with a subroutine call. Usually, a sort is made as, for example: sort {$a = $b} @array; But my intention is something like: sort subroutine_call @array; sub subroutine

Re: Sorting from subroutine call

2006-12-02 Thread Sergio Escalada
# # hashref? Why in the WORLD is the database being kept in a hashref? # Oh, it's an exercise for class, and I must keep data in a hashtable, it's not my fault ^_^ Thanks for your code :) # # if you have a small number of columns you want to sort by, build a # simple subroutine to sort by

Re: Sorting from subroutine call

2006-12-02 Thread D. Bolliger
Sergio Escalada am Samstag, 2. Dezember 2006 15:41: Thanks for replies. The purpouse of this mini-script is to list the rows from a database loaded in memory ($ref_db is the reference to hashtable that cotains the DB). So I want to order the fields by different sort rules, and make the

Re: Sorting from subroutine call

2006-12-02 Thread Sergio Escalada
Yes! It was exactly what I was trying to do. I wasn't so wrong after all. Thanks you, Dani, your code helps me a lot :D 2006/12/2, D. Bolliger [EMAIL PROTECTED]: Sergio Escalada am Samstag, 2. Dezember 2006 15:41: Thanks for replies. The purpouse of this mini-script is to list the rows

subroutine call makes foreach exit?

2006-11-16 Thread Andy Greenwood
I'm writing a script for work that will dig for DNS records for a given domain name and put the entries into an array. At the end of the digging, it outputs the array elements to the screen, asks if everything looks good, and if so, writes them out to the shell and builds a zone file. However,

Re: subroutine call makes foreach exit?

2006-11-16 Thread Jay Savage
On 11/16/06, Andy Greenwood [EMAIL PROTECTED] wrote: I'm writing a script for work that will dig for DNS records for a given domain name and put the entries into an array. At the end of the digging, it outputs the array elements to the screen, asks if everything looks good, and if so, writes

Re: subroutine call makes foreach exit?

2006-11-16 Thread Andy Greenwood
On 11/16/06, Jay Savage [EMAIL PROTECTED] wrote: On 11/16/06, Andy Greenwood [EMAIL PROTECTED] wrote: I'm writing a script for work that will dig for DNS records for a given domain name and put the entries into an array. At the end of the digging, it outputs the array elements to the screen,

Re: subroutine call makes foreach exit?

2006-11-16 Thread Tom Phoenix
On 11/16/06, Andy Greenwood [EMAIL PROTECTED] wrote: if (/^$domain.+MX\s+(\d+)\s+(.+)/) { Because $domain is a string (and not a pattern), interpolating it into a pattern could cause troubles. First, any metacharacters it contains may affect the match. But also, is that pattern going

Re: subroutine call makes foreach exit?

2006-11-16 Thread John W. Krahn
Andy Greenwood wrote: I'm writing a script for work that will dig for DNS records for a given domain name and put the entries into an array. At the end of the digging, it outputs the array elements to the screen, asks if everything looks good, and if so, writes them out to the shell and

Subroutine call

2004-11-24 Thread TapasranjanMohapatra
Hi All, I have a querry if the following can be possible. Suppose I have many sub routines in a module abc.pm package abc; sub zzzq { } sub zzze { } sub zzzr { } Now I use this module in another script. I want to call the sub routines, as suggested by the argument passed to the script. i.e.

RE: Subroutine call

2004-11-24 Thread Charles K. Clarkson
TapasranjanMohapatra [EMAIL PROTECTED] wrote: : Suppose I have many sub routines in a module abc.pm : : package abc; : : sub zzzq : { : } : : sub zzze : { : } : sub zzzr : { : } : : Now I use this module in another script. I want to call the : sub routines, as suggested by the argument passed

Re: Subroutine call

2004-11-24 Thread JupiterHost.Net
TapasranjanMohapatra wrote: Hi All, Hello, I have a querry if the following can be possible. Suppose I have many sub routines in a module abc.pm package abc; Your package should use strict and warnings :) sub zzzq { } sub zzze { } sub zzzr { } Now I use this module in another script. I want to

Re: Subroutine call

2004-11-24 Thread Todd W
Charles K. Clarkson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] TapasranjanMohapatra [EMAIL PROTECTED] wrote: : Suppose I have many sub routines in a module abc.pm : : package abc; : : sub zzzq : { : } : : sub zzze : { : } : sub zzzr : { : } : : Now I use this

Re: Subroutine call

2004-11-24 Thread Lawrence Statton N1GAK/XE2
[EMAIL PROTECTED] (TapasranjanMohapatra) writes: Now I use this module in another script. I want to call the sub routines, as suggested by the argument passed to the script. i.e. my_script q should call the sub routine zzzq, my_script e should call the sub routine zzze, ... when there

Re: subroutine call weirdness

2004-02-28 Thread R. Joseph Newton
Michael C. Davis wrote: At 08:54 PM 2/27/04 -0800, R. Joseph Newton wrote: I think it might also be good to refer the OP back to James' post, which he seems to have overlooked. The caveat you provided earlier still makes sense. Thanks for the ideas. Are you referring to James' suggestion

subroutine call weirdness

2004-02-27 Thread Michael C. Davis
Hi list, I just ran across some unexpected results in passing arguments to user-defined subroutines. Could someone who has been around Perl a while longer check this and make sure I'm seeing this right? I've got some code that implements a constant as a subroutine call (to keep the constant

Re: subroutine call weirdness

2004-02-27 Thread James Edward Gray II
a constant as a subroutine call (to keep the constant from being modified). When I use that subroutine in an arithmetic expression, it is consuming everything to the right of it as its argument list. Obviously, you can always use parens to make statements unambiguous, as you've demonstrated. I

RE: subroutine call weirdness

2004-02-27 Thread David le Blanc
From: Michael C. Davis [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 11:55 PM To: [EMAIL PROTECTED] Subject: subroutine call weirdness Hi list, I just ran across some unexpected results in passing arguments to user-defined subroutines. Could someone who has been around

Re: subroutine call weirdness

2004-02-27 Thread Rob Dixon
Michael C. Davis wrote: I just ran across some unexpected results in passing arguments to user-defined subroutines. Could someone who has been around Perl a while longer check this and make sure I'm seeing this right? I've got some code that implements a constant as a subroutine call

Re: subroutine call weirdness

2004-02-27 Thread Rob Dixon
David Le Blanc wrote: From: Michael C. Davis [mailto:[EMAIL PROTECTED] Sent: Friday, 27 February 2004 11:55 PM To: [EMAIL PROTECTED] Subject: subroutine call weirdness Hi list, I just ran across some unexpected results in passing arguments to user-defined subroutines. Could

Re: subroutine call weirdness

2004-02-27 Thread Michael C. Davis
At 02:32 PM 2/27/04 -, Rob Dixon wrote: I haven't looked at this at all carefully, but my first guess would be be that you need to call the subroutine as if it was one: print MyProject::CoreConstants::EarliestValidTimestampAsNumber() + 1, \n; Yes, this certainly solves the problem I'm

RE: subroutine call weirdness

2004-02-27 Thread Michael C. Davis
by default? Or is importing/exporting a separate issue from prototypes? It seems there are some hoops one has to jump through to make sure that the prototype is 'known' for any given subroutine call, but I'm not real clear as to just what those hoops are ... Thanks again. -- To unsubscribe, e-mail

Re: subroutine call weirdness

2004-02-27 Thread Rob Dixon
not export any names by default? Or is importing/exporting a separate issue from prototypes? It seems there are some hoops one has to jump through to make sure that the prototype is 'known' for any given subroutine call, but I'm not real clear as to just what those hoops are ... You're now

Re: subroutine call weirdness

2004-02-27 Thread R. Joseph Newton
? I've got some code that implements a constant as a subroutine call (to keep the constant from being modified). When I use that subroutine in an arithmetic expression, it is consuming everything to the right of it as its argument list. Obviously, you can always use parens to make

Re: subroutine call weirdness

2004-02-27 Thread R. Joseph Newton
, in the case when the module does not export any names by default? Or is importing/exporting a separate issue from prototypes? It seems there are some hoops one has to jump through to make sure that the prototype is 'known' for any given subroutine call, but I'm not real clear as to just

Re: subroutine call weirdness

2004-02-27 Thread Michael C. Davis
At 08:54 PM 2/27/04 -0800, R. Joseph Newton wrote: I think it might also be good to refer the OP back to James' post, which he seems to have overlooked. The caveat you provided earlier still makes sense. Thanks for the ideas. Are you referring to James' suggestion about always using parens on