Simpler....

2001-12-04 Thread Daniel Falkenberg
Hey all, Please don't stree to much over this one but, is there an easier way of writing this? while(1){ if ($status == 1) { #Do this sub... sub(); elsif ($status == 1) { #Do this other sub... sub2(); } else { #Continue while loop... } } Can I make it smaller. I wan

Re: Simpler....

2001-12-04 Thread Ahmed Moustafa
Dan, does sub() changes the value of $status? Also, do sub() and sub2() break the loop? Daniel Falkenberg wrote: > Hey all, > > Please don't stree to much over this one but, is there an easier way of > writing this? > > while(1){ > if ($status == 1) { > #Do this sub... > sub(); >

Re: Simpler....

2001-12-04 Thread Ahmed Moustafa
t;Sent: Wednesday, 5 December 2001 3:27 PM >To: Daniel Falkenberg >Cc: [EMAIL PROTECTED] >Subject: Re: Simpler > > >Dan, does sub() changes the value of $status? Also, do sub() and sub2() >break the loop? > >Daniel Falkenberg wrote: > >>Hey all, >> >&

Re: Simpler....

2001-12-04 Thread Hasanuddin Tamir
On Wed, 5 Dec 2001, Daniel Falkenberg <[EMAIL PROTECTED]> wrote, > Hey all, > > Please don't stree to much over this one but, is there an easier way of > writing this? > > while(1){ > if ($status == 1) { > #Do this sub... > sub(); > elsif ($status == 1) { > #Do this other sub...

Re: Simpler....

2001-12-04 Thread Jim Conner
At 15:22 12.05.2001 +1030, Daniel Falkenberg wrote: >Hey all, > >Please don't stree to much over this one but, is there an easier way of >writing this? Ok. I haven't read the thread yet because I want to take a fresh shot at this... so here goes... >while(1){ > if ($status == 1) { > #D

Re: Simpler....

2001-12-05 Thread Maxim Berlin
Hello Daniel, Wednesday, December 05, 2001, Daniel Falkenberg <[EMAIL PROTECTED]> wrote: DF> Please don't stree to much over this one but, is there an easier way of DF> writing this? DF> while(1){ DF> if ($status == 1) { DF> #Do this sub... DF> sub(); DF> elsif ($status == 1) { DF>

RE: Simpler....

2001-12-05 Thread Shinagare, Sandeep
December 2001 11:38 To: [EMAIL PROTECTED] Subject: Re: Simpler Hello Daniel, Wednesday, December 05, 2001, Daniel Falkenberg <[EMAIL PROTECTED]> wrote: DF> Please don't stree to much over this one but, is there an easier way of DF> writing this? DF> while(1){ DF>

Re: Simpler....

2001-12-05 Thread Brett W. McCoy
On Wed, 5 Dec 2001, Daniel Falkenberg wrote: > Please don't stree to much over this one but, is there an easier way of > writing this? > > while(1){ > if ($status == 1) { > #Do this sub... > sub(); > elsif ($status == 1) { > #Do this other sub... > sub2(); > } else { > #

Re[2]: Simpler....

2001-12-05 Thread Maxim Berlin
Hello Sandeep, Wednesday, December 05, 2001, Shinagare, Sandeep <[EMAIL PROTECTED]> wrote: SS> Hi All, SS> I am trying to learn Perl and want to begin with getting an interpreter for SS> the Windows OS (NT). SS> Which are the good ones around for download? http://www.perl.com/pub/a/language/inf

Would it be simpler ?

2002-06-20 Thread Connie Chan
Hi all, I am now making a bookshelf program with perl. At this very beginning, I do wonder if the below script can be simpler or not... sub getQuery {my $queryStr = @_; my %ret; if (! $queryStr) { $ret{user} = 'system' ; $ret{book} = 'index' ; $ret{page}

Re: default value -simpler method?

2002-04-10 Thread p
Hi, Just out of interest, could you do it this way: my $default = "/foo/bar/blat"; print "File to use? [$default] "; chomp(my $question = || $default); I've just started using this sort of approach to assign default values to undefined/null parameters, eg: my $age = param('age') ||

Re: default value -simpler method?

2002-04-10 Thread Elias Assmann
> my $age = param('age') || 12; > > Is that an acceptable way of doing things, or is there some > glaringly obvious mistake? It seems to pick up null and undefined > values okay, without any errors (i.e. no age param, or age= will > get 12). Only problem is that it treats 0 as null/undefined, bu

Re: Would it be simpler ?

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 17:27:35 GMT, Connie Chan wrote: > Hi all, I am now making a bookshelf program with perl. > At this very beginning, I do wonder if the below script > can be simpler or not... > > [code snipped] Please don't do this: use CGI.pm instead: #! pe

Re: Would it be simpler ?

2002-06-20 Thread Jeff 'japhy' Pinyan
t;handle like /?user=who&book=what&page=num, so I can deal with it by >hash. But does anyway can make the above script simpler if I really got >to deal on query string as this way ? ( Actually I am interested to >learn what I can do to deal with this matching =) ) If you want

Re: Would it be simpler ?

2002-06-20 Thread Connie Chan
Thanks a lot Japhy, that's exactly the key I want =) Assign the value at first, replace it when match... That's very great !!! Smiley Connie =) > > sub getQuery { > my %ret = ( > user => 'system', > book => 'index', > page => 0, > ); > > my $query = shift or ret

Re: Would it be simpler ?

2002-06-20 Thread Connie Chan
Why CGI.pm ? What difference ? =) - Original Message - From: "Felix Geerinckx" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, June 21, 2002 1:54 AM Subject: Re: Would it be simpler ? > on Thu, 20 Jun 2002 17:27:35 GMT, Connie Chan wrote: > &g

Re: Would it be simpler ?

2002-06-20 Thread Felix Geerinckx
on Thu, 20 Jun 2002 20:37:32 GMT, Connie Chan wrote: > Why CGI.pm ? What difference ? =) Because it already contains all logic to parse *all* standards conforming query-strings, not only your special case. Soon you may want to work with an html-form instead of appending the query string to a U

Re: Would it be simpler ?

2002-06-20 Thread Jeff 'japhy' Pinyan
On Jun 21, Connie Chan said: >Why CGI.pm ? What difference ? =) Because CGI does it right. It's easy to do it wrong. Very wrong, very easily. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.

How's a simpler way to do this? (pattern)

2004-12-04 Thread pablo wablo
Hello, I'm new to perl. I'm trying a regular expression that accepts register format for assembly. (r0 - r31) I have this regexp $in =~ /\b[rR] ( ([0-9]) | ( [12][0-9] ) | ( 3[01] ))\b/x; it works fine but I'm not satisfied with it.. (too long!) I have something in mind but I dont know th

Re: How's a simpler way to do this? (pattern)

2004-12-05 Thread Ing. Branislav Gerzo
pablo wablo [pw], on Saturday, December 4, 2004 at 21:07 (-0800 (PST)) has on mind: pw> $in =~ /\b[rR] ( ([0-9]) | ( [12][0-9] ) | ( 3[01] pw> ))\b/x; pw> it works fine but I'm not satisfied with it.. (too pw> long!) it's nothing bad on your regexp, just you could use \d instead [0-9]. Defining