Re: Eval scoping question

2009-12-10 Thread C.DeRykus
On Dec 10, 12:57 pm, shawnhco...@gmail.com (Shawn H Corey) wrote: > C.DeRykus wrote: > > On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote: > >> On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote: > > >>> ... > > >> ... > >> Also, in this case, I'd write the eval for compile-time and

Re: Eval scoping question

2009-12-10 Thread Dr.Ruud
C.DeRykus wrote: On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote: On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote: Also, in this case, I'd write the eval for compile-time and check for errors: eval { asub() }; die $@ if $@; No, sorry, that's a "useless use of

Re: pid file issues...? HUH???

2009-12-10 Thread Jim Gibson
At 11:43 AM -0800 12/9/09, cerr wrote: Hi There, I use below code to make sure i have only one instance of my script running at a time. But weirdly enough i sometimes seem to have running two instances. This script is getting called on a regular basis by a cron job and may take a long time (30+m

Re: Feedback, please

2009-12-10 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> Uri Guttman wrote: >>> "SHC" == Shawn H Corey writes: SHC> Call it paranoid defensive programming. ;) >> >> overly paranoid imo. but that doesn't mean the bugs aren't out to get >> ya! :) SHC> Just because you're not paranoid doesn't

Re: Feedback, please

2009-12-10 Thread Shawn H Corey
Uri Guttman wrote: >> "SHC" == Shawn H Corey writes: > SHC> Call it paranoid defensive programming. ;) > > overly paranoid imo. but that doesn't mean the bugs aren't out to get > ya! :) Just because you're not paranoid doesn't mean computers don't hate me. -- Just my 0.0002 million

Re: Feedback, please

2009-12-10 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> Uri Guttman wrote: >>> "SHC" == Shawn H Corey writes: >> SHC> Uri Guttman wrote: >> >> why the || '' ?? >> >> >> >> the help sub doesn't seem to exit/die >> SHC> Not proven; you cannot assume this. >> SHC> One school of thou

Re: Feedback, please

2009-12-10 Thread Shawn H Corey
Uri Guttman wrote: >> "SHC" == Shawn H Corey writes: > > SHC> Uri Guttman wrote: > >> why the || '' ?? > >> > >> the help sub doesn't seem to exit/die > > SHC> Not proven; you cannot assume this. > > SHC> One school of thought about programming is that all functions must have >

Re: Feedback, please

2009-12-10 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> Uri Guttman wrote: >> why the || '' ?? >> >> the help sub doesn't seem to exit/die SHC> Not proven; you cannot assume this. SHC> One school of thought about programming is that all functions must have SHC> only one return and all programs

Re: Feedback, please

2009-12-10 Thread Steve Bertrand
Shawn H Corey wrote: > Uri Guttman wrote: >> why the || '' ?? >> >> the help sub doesn't seem to exit/die > > Not proven; you cannot assume this. > > One school of thought about programming is that all functions must have > only one return and all programs must have only one exit. Therefore, > h

Re: Eval scoping question

2009-12-10 Thread Shawn H Corey
C.DeRykus wrote: > On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote: >> On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote: >> >>> ... > >> ... >> Also, in this case, I'd write the eval for compile-time and check >> for errors: >> >> eval { asub() }; >> die $@ if $@; >> >

Re: Eval scoping question

2009-12-10 Thread C.DeRykus
On Dec 8, 1:57 am, dery...@gmail.com (C.DeRykus) wrote: > On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote: > >> ... > ... > Also, in this case, I'd write the eval for compile-time and check > for errors: > >      eval { asub() }; >      die $@ if $@; > No, sorry, that's a "useless us

Re: Feedback, please

2009-12-10 Thread Shawn H Corey
Uri Guttman wrote: > why the || '' ?? > > the help sub doesn't seem to exit/die Not proven; you cannot assume this. One school of thought about programming is that all functions must have only one return and all programs must have only one exit. Therefore, help() may return or it may not. Unti

Re: passing command-line arg containing '@'

2009-12-10 Thread Alan Haggai Alavi
>I need to pass an command-line arg that is a string which contains the '@'. Is there any way to do this and also 'tell' Perl not to interpret this as other than a '@' character? > >Thx. Hi, Perl would not do anything with command-line arguments unless you tell it otherwise. Check if you are

Re: Feedback, please

2009-12-10 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> John W. Krahn wrote: >> Shawn H Corey wrote: >>> Steve Bertrand wrote: You can replace them all with this: my $station = $channels{ $opt_s }; >>> >>> my $station = $channels{ $opt_s } || help(); >> >> my $station = $c

Re: Feedback, please

2009-12-10 Thread Steve Bertrand
Shawn H Corey wrote: > John W. Krahn wrote: >> Shawn H Corey wrote: >>> Steve Bertrand wrote: You can replace them all with this: my $station = $channels{ $opt_s }; >>> my $station = $channels{ $opt_s } || help(); >> my $station = $channels{ $opt_s } or help(); > > > my $station =

Re: Feedback, please

2009-12-10 Thread Shawn H Corey
John W. Krahn wrote: > Shawn H Corey wrote: >> Steve Bertrand wrote: >>> You can replace them all with this: >>> >>> my $station = $channels{ $opt_s }; >> >> my $station = $channels{ $opt_s } || help(); > > my $station = $channels{ $opt_s } or help(); my $station = $channels{ $opt_s } || '' or h

Re: Feedback, please

2009-12-10 Thread John W. Krahn
Shawn H Corey wrote: Steve Bertrand wrote: You can replace them all with this: my $station = $channels{ $opt_s }; my $station = $channels{ $opt_s } || help(); my $station = $channels{ $opt_s } or help(); Or: ( my $station = $channels{ $opt_s } ) || help(); John -- The programmer is figh

pid file issues...? HUH???

2009-12-10 Thread cerr
Hi There, I use below code to make sure i have only one instance of my script running at a time. But weirdly enough i sometimes seem to have running two instances. This script is getting called on a regular basis by a cron job and may take a long time (30+min)to complete but still...I can't figure

Re: Feedback, please

2009-12-10 Thread Shawn H Corey
Steve Bertrand wrote: > You can replace them all with this: > > my $station = $channels{ $opt_s }; my $station = $channels{ $opt_s } || help(); Make sure help() ends with `return;` or `exit();` -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and

Re: Feedback, please

2009-12-10 Thread Steve Bertrand
Steve Bertrand wrote: > trapd...@trapd00r.se wrote: >> On 08/12/09 23:15 -0500, Steve Bertrand wrote: >>> To the OP, without code, it makes it difficult to tell what you are >>> after. >> Sorry, tired... :) Here's the code > > You didn't cc the list ;) > >> #!/usr/bin/perl >> use strict; >> use

Re: Feedback, please

2009-12-10 Thread Steve Bertrand
trapd...@trapd00r.se wrote: > On 08/12/09 23:15 -0500, Steve Bertrand wrote: >> To the OP, without code, it makes it difficult to tell what you are >> after. > > Sorry, tired... :) Here's the code You didn't cc the list ;) > #!/usr/bin/perl > use strict; > use warnings; Nice. > use diagnostic

Re: Problem with break

2009-12-10 Thread Philip Potter
2009/12/9 Anush : > Hi all, i have a problem with the break statement, in my program the > break is not working, that is the control would not breaks from the > loop. Please help me. Can you give an example of your problem? What is your code? What did it do? What did you expect it to do? Perhaps

Problem with break

2009-12-10 Thread Anush
Hi all, i have a problem with the break statement, in my program the break is not working, that is the control would not breaks from the loop. Please help me. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: matching an element from one array to another

2009-12-10 Thread Philip Potter
2009/12/10 John W. Krahn : > Noah wrote: >> >> Hi there, > > Hello, > >> I am hoping to figure out the best Way to write something.  I have two >> arrays @previous_hostnames and @hostnames. >> >> I want to figure out if there is at least one matching element in >> @previous_hostnames that is found