Re: anonymize function return

2006-04-03 Thread Jeff Pang
>=== >sub func1 { >my (%rez); > >$rez{one} = 'one'; >$rez{two} = 'two'; >$rez{seven} = 'seven'; > >return %rez; >} >=== > >and I have such piece of code: > >=== >

anonymize function return

2006-04-03 Thread Vadim Kutchin
Hi! I have some function, such as: === sub func1 { my (%rez); $rez{one} = 'one'; $rez{two} = 'two'; $rez{seven} = 'seven'; return %rez; } === and I have such piece of code:

Re: newbie sort question

2006-04-03 Thread Val Genova
thanks this solved my problem my @output_sorted = sort { (split /,/, $b)[0] <=> (split /,/, $a)[0] } @output; thanks to all that helped Jeff Pang <[EMAIL PROTECTED]> writes: > >>this is my friend's script >> >># collect all score >> my @output = (); >> my @old_output = (); >> for

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread nishanth ev
Hello, Just create a daemon and then put an infinite loop. Call the subroutines with a sleep set accordingly, so that the subroutine will run only at specified interval. Below is an sample code you can use. Program will run as a daemon and you can kill it using kill -9 Regards Nishanth #!/us

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread Mr. Shawn H. Corey
On Tue, 2006-04-04 at 13:07 +1000, James Turnbull wrote: > Mr. Shawn H. Corey wrote: > > First question: are you running under M$ Windows or UNIX? > > > Unix - Linux or BSD generally > > Second question: does this periodic function relying on data of the main > > process? > > > Yes - it uses

Re: simple profiling?

2006-04-03 Thread Owen
Bryan R Harris wrote: > >>On 4/1/06, Bryan Harris <[EMAIL PROTECTED]> wrote: >>snip >> >>>This looks very interesting... I downloaded it, but I have no idea how to >>>install it, though. I'm a modules-idiot. I tried putting the .pm file in >>>the current directory and putting "use TimeTick.pm;"

Re: which subroutine

2006-04-03 Thread Tom Phoenix
On 4/3/06, Dr.Ruud <[EMAIL PROTECTED]> wrote: > my %table; > eval '$table{' . $_ . '} = \&' . $_ >for qw(cat jackalope yeti); myeyesmyeyesthegogglesdoNOTHING When I posted my code, I said that I wrote it that way to avoid using "the dreaded soft reference". But using a soft reference is far

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread John W. Krahn
James Turnbull wrote: > Hi Hello, > Anyone know of a way to create a loop (or something similar) that > automatically schedules the execution of a sub-routine periodically from > within a program, for example execute check() every 600 seconds or the > like? The program would be running as a daem

Re: hashref slices

2006-04-03 Thread John W. Krahn
Ryan Perry wrote: > I wanted to use a hash slice, but I'm using a hashref. Can I do both? Yes. > my @current_Flags=( $hormone . 'DoseCycle', anotherVar, somethingElse ); > $flags->[EMAIL PROTECTED]>selectrow_array(qq{$SQLstmt}); #returns @{ $flags }{ @current_Flags } = $dbh->selectrow_array-

Re: which subroutine

2006-04-03 Thread Dr.Ruud
"Tom Phoenix" schreef: > my %table = ( > cat => \&cat, > jackalope => \&jackalope, > yeti => \&yeti, > ); An alternative is to build that with eval: my %table; eval '$table{' . $_ . '} = \&' . $_ for qw(cat jackalope yeti); -- Affijn, Ruud "Gewoon is een t

hashref slices

2006-04-03 Thread Ryan Perry
I wanted to use a hash slice, but I'm using a hashref. Can I do both? my @current_Flags=( $hormone . 'DoseCycle', anotherVar, somethingElse ); $flags->[EMAIL PROTECTED]>selectrow_array(qq{$SQLstmt}); #returns an array, $flags is my hashref Thanks! -- To unsubscribe, e-mail: [EMAIL PROTE

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread James Turnbull
Mr. Shawn H. Corey wrote: First question: are you running under M$ Windows or UNIX? Unix - Linux or BSD generally Second question: does this periodic function relying on data of the main process? Yes - it uses a hash defined in the mainline. Regards James Turnbull -- To unsubscribe,

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread Mr. Shawn H. Corey
On Tue, 2006-04-04 at 12:52 +1000, James Turnbull wrote: > James Turnbull wrote: > > Hi > > > > Anyone know of a way to create a loop (or something similar) that > > automatically schedules the execution of a sub-routine periodically > > from within a program, for example execute check() every 60

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread Tom Phoenix
On 4/3/06, James Turnbull <[EMAIL PROTECTED]> wrote: > The mainline program is monitoring something - every x seconds I wish to > execute a subroutine from within the mainline and return to the mainline > after executing the subroutine to continue the monitoring. So, it sounds as if you want your

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread Omega -1911
Your best bet is to use a cron job for this. Otherwise, you'd waste server resources. What happens when the process is killed or the server restarted? On 4/3/06, James Turnbull <[EMAIL PROTECTED]> wrote: > > Hi > > Anyone know of a way to create a loop (or something similar) that > automatically s

Re: Automatically scheduling the execution of a sub-routine

2006-04-03 Thread James Turnbull
James Turnbull wrote: Hi Anyone know of a way to create a loop (or something similar) that automatically schedules the execution of a sub-routine periodically from within a program, for example execute check() every 600 seconds or the like? The program would be running as a daemon on the hos

Automatically scheduling the execution of a sub-routine

2006-04-03 Thread James Turnbull
Hi Anyone know of a way to create a loop (or something similar) that automatically schedules the execution of a sub-routine periodically from within a program, for example execute check() every 600 seconds or the like? The program would be running as a daemon on the host. Thanks James Turn

Re: which subroutine

2006-04-03 Thread Mr. Shawn H. Corey
On Mon, 2006-03-04 at 15:41 -0500, The Ghost wrote: > based upon the string in a variable, I want to run a particular > subroutine: > > my $var='cat'; > > > > $var='fish'; > > &$var; # I want to run fish if $var is a fish or cat if $var is a cat... > > sub cat { }; > sub do

RE: simple profiling?

2006-04-03 Thread Bryan R Harris
> On 4/1/06, Bryan Harris <[EMAIL PROTECTED]> wrote: > snip >> This looks very interesting... I downloaded it, but I have no idea how to >> install it, though. I'm a modules-idiot. I tried putting the .pm file in >> the current directory and putting "use TimeTick.pm;" at the beginning of my >>

Re: which subroutine

2006-04-03 Thread Tom Phoenix
On 4/3/06, The Ghost <[EMAIL PROTECTED]> wrote: > based upon the string in a variable, I want to run a particular > subroutine: One way to do this (without the dreaded soft reference) is to have a lookup table: my %table = ( cat => \&cat, jackalope => \&jackalope, yet

which subroutine

2006-04-03 Thread The Ghost
based upon the string in a variable, I want to run a particular subroutine: my $var='cat'; $var='fish'; &$var; # I want to run fish if $var is a fish or cat if $var is a cat... sub cat { }; sub dog { }; sub fish { }; For some reason I think I'll be told thi

Re: Which structure to handle data

2006-04-03 Thread Dr.Ruud
Andrej Kastrin schreef: > I need to re-sort a set of data. I think that the below example is > self explained; so which Perl structure should I use to handle this > dataset? > > Thanks in advance for any suggestion, Andre > > > 2;John;Apple;Banana > 3;Andrew;Pear;Apple;Melon;Orange > 8;Susan;Pear;

Re: Which structure to handle data

2006-04-03 Thread John W. Krahn
Andrej Kastrin wrote: > Dear Perl community, Hello, > I need to re-sort a set of data. I think that the below example is self > explained; so which Perl structure should I use to handle this dataset? > > Thanks in advance for any suggestion, Andre > > > 2;John;Apple;Banana > 3;Andrew;Pear;Appl

Re: How to manage around 1000 entries which will constantly be changing

2006-04-03 Thread Jay Savage
On 4/1/06, Frank Bax <[EMAIL PROTECTED]> wrote: > At 06:59 PM 3/31/06, Mr. Shawn H. Corey wrote: > > >On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote: > > > You should loop over the input, pushing each item on to an array. If > > > at any time you have 2000 items in the array, sort them and di

Re: Net::SMTP module

2006-04-03 Thread JupiterHost.Net
Sonika Sachdeva wrote: What is the correct method to authenticate for sending mails , I found auth(). But its not working... Try Mail::Sender::Easy It handles SMTP authentication quite nicely :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE

RE: How to manage around 1000 entries which will constantly bechanging

2006-04-03 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Mr. Shawn H. Corey wrote: > On Sat, 2006-01-04 at 09:57 -0500, Frank Bax wrote: >> I'm not the OP, but I have a script with a similar problem. The >> script has some logic that generates many (thousands of billions) of >> combinations from a little bit of data and only the best 100 combos >> are o

Net::SMTP module

2006-04-03 Thread Sonika Sachdeva
What is the correct method to authenticate for sending mails , I found auth(). But its not working...

Re: Which structure to handle data

2006-04-03 Thread Tom Phoenix
On 4/3/06, Andrej Kastrin <[EMAIL PROTECTED]> wrote: > I need to re-sort a set of data. I think that the below example is self > explained; so which Perl structure should I use to handle this dataset? Perl has two data structures. Arrays hold items in order, while hashes keep track of their data

Which structure to handle data

2006-04-03 Thread Andrej Kastrin
Dear Perl community, I need to re-sort a set of data. I think that the below example is self explained; so which Perl structure should I use to handle this dataset? Thanks in advance for any suggestion, Andre 2;John;Apple;Banana 3;Andrew;Pear;Apple;Melon;Orange 8;Susan;Pear;Melon 2;John;App

Re: Example of IO::Tee use

2006-04-03 Thread Tom Phoenix
On 4/3/06, Edi STOJICEVIC <[EMAIL PROTECTED]> wrote: > I've never used IO::Tee module and I would like to have the same thing > like tee -a on Unix system... > > Do you have some example of how to use it ? Do you need more of an example than what's in the documentation? http://search.cpan.or

Re: Simple Issues with Pod (on verbose and help page without param).

2006-04-03 Thread Tom Phoenix
On 4/3/06, Edward WIJAYA <[EMAIL PROTECTED]> wrote: > 1. How can I make the code below return man page when I simpy do: > $ perl mycode.pl > > Namely no param is passed here. unless (@ARGV) { # no command-line args pod2usage(-verbose => 2); exit; } > 2. Ve

Re: simple profiling?

2006-04-03 Thread Jay Savage
On 3/31/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > Mr. Shawn H. Corey wrote: > > On Fri, 2006-31-03 at 14:41 -0700, Bryan Harris wrote: > >>I have a script that takes ~5 seconds to run, but I'd like to get it down to > >><1 sec. My problem is I don't know which part is the slow part. So given

Re: simple profiling?

2006-04-03 Thread Peter Scott
On Sun, 02 Apr 2006 09:11:13 -0700, Bryan Harris wrote: >> On Sat, 01 Apr 2006 09:29:47 -0700, Bryan Harris wrote: >>> This looks very interesting... I downloaded it, but I have no idea how >>> to install it, though. I'm a modules-idiot. I tried putting the .pm >>> file in the current directory

Re: simple profiling?

2006-04-03 Thread brian d foy
In article <[EMAIL PROTECTED]>, Bryan Harris <[EMAIL PROTECTED]> wrote: > I have a script that takes ~5 seconds to run, but I'd like to get it down to > <1 sec. My problem is I don't know which part is the slow part. So given > something like this: You don't have to modify your code to profile

Example of IO::Tee use

2006-04-03 Thread Edi STOJICEVIC
Hi, I've never used IO::Tee module and I would like to have the same thing like tee -a on Unix system... Do you have some example of how to use it ? Regards, -- . ''`. (\___/) E d i S T O J I C E V I C : :' : (='.'=) http://www.debianworld.org `. `~' (")_(") GPG: C360 FCF0 AB3A 2AB0

Simple Issues with Pod (on verbose and help page without param).

2006-04-03 Thread Edward WIJAYA
Dear all, Here is a code which use Getopt::Long to produce a help instruction. As can be seen below, I also want my code to print out the help message when no argument is passed. My question are: 1. How can I make the code below return man page when I simpy do: $ perl mycode.pl Namely no

Re: simple profiling?

2006-04-03 Thread Chas Owens
On 4/1/06, Bryan Harris <[EMAIL PROTECTED]> wrote: snip > This looks very interesting... I downloaded it, but I have no idea how to > install it, though. I'm a modules-idiot. I tried putting the .pm file in > the current directory and putting "use TimeTick.pm;" at the beginning of my > code, but

Re: @hash{} versus $hash{}

2006-04-03 Thread John W. Krahn
John Ackley wrote: > Inherited code (from Verisign): @[EMAIL PROTECTED] = split /\t/,$rec; > which worked but really puzzled me. What is happening is a hash slice assignment similar to: @datafield{ 'a', 'b', 'c' } = ( 'd', 'e', 'f' ); Where the first element in @send is used as the key for the