Re: Accepting default value for user input

2009-03-02 Thread Telemachus
On Mon Mar 02 2009 @ 7:54, Sarsamkar, Paryushan wrote: > Ohh ... sorry ... after rethinking over it ... I think it converts the > $normal to lower case before comparison Right, which is a standard and smart thing to do since you can't count on your users to correctly type 'y-e-s'. Damn users.

RE: Accepting default value for user input

2009-03-02 Thread Sarsamkar, Paryushan
@perl.org Cc: Gunnar Hjalmarsson Subject: RE: Accepting default value for user input Ok thanks. But is lc needed here? I tried without using lc it works fine because output of comparison will be always 1 if I am not wrong. last if lc $normal eq 'yes' or lc $normal eq 'no'

RE: Accepting default value for user input

2009-03-02 Thread Sarsamkar, Paryushan
...@gunnar.cc] Sent: Monday, March 02, 2009 5:44 PM To: beginners@perl.org Subject: Re: Accepting default value for user input Sarsamkar, Paryushan wrote: > I did not understand meaning of this line :( below. I only understood > that it will exit while loop if the input has either yes or no.

Re: Accepting default value for user input

2009-03-02 Thread Gunnar Hjalmarsson
Sarsamkar, Paryushan wrote: I did not understand meaning of this line :( below. I only understood that it will exit while loop if the input has either yes or no. But then what is " grep { lc $normal eq $_ } "? last if grep { lc $normal eq $_ } 'yes', 'no'; It's another way to say: last if

RE: Accepting default value for user input

2009-03-01 Thread Sarsamkar, Paryushan
anks, Paryushan -Original Message- From: Gunnar Hjalmarsson [mailto:nore...@gunnar.cc] Sent: Saturday, February 28, 2009 3:35 AM To: beginners@perl.org Subject: Re: Acepting default value for user input Chas. Owens wrote: > On Fri, Feb 27, 2009 at 11:07, Gunnar Hjalmarsson wrote: >

Re: Acepting default value for user input

2009-02-27 Thread Rob Dixon
Gunnar Hjalmarsson wrote: > Chas. Owens wrote: >> On Fri, Feb 27, 2009 at 11:07, Gunnar Hjalmarsson wrote: >>> Sarsamkar, Paryushan wrote: >>>> I would like to accept some user inputs (using ), but it might be >>>> easier for a user if I can provide the

Re: Acepting default value for user input

2009-02-27 Thread Jim Gibson
On 2/27/09 Fri Feb 27, 2009 2:05 PM, "Gunnar Hjalmarsson" scribbled: > Which takes us to the obvious step of validating the user input. > > my $normal; > while (1) { > print 'Do you want to do the normal thing? [yes] : '; > chomp( $normal = ); > $normal =

Re: Acepting default value for user input

2009-02-27 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Fri, Feb 27, 2009 at 11:07, Gunnar Hjalmarsson wrote: Sarsamkar, Paryushan wrote: I would like to accept some user inputs (using ), but it might be easier for a user if I can provide the default value, so that they just have to press ENTER. How can I do that? I&#x

Re: Re: Acepting default value for user input

2009-02-27 Thread Chas. Owens
On Fri, Feb 27, 2009 at 11:16, wrote: > Hi people!! > > I´m using Perl for the first time in my Mac OS X... > > > How can I check installed modules ??? > > > I am running a Mac OS X Leopard 10.5.6 with Perl version v5.8.8 built for > darwin-thread-multi-2level... > > > Thanks > Please do not

Re: Acepting default value for user input

2009-02-27 Thread Chas. Owens
On Fri, Feb 27, 2009 at 11:07, Gunnar Hjalmarsson wrote: > Sarsamkar, Paryushan wrote: >> >> I would like to accept some user inputs (using ), but it might be >> easier for a user if I can provide the default value, so that they just >> have to press ENTER. >>

Re: Re: Acepting default value for user input

2009-02-27 Thread juliaaaa . 1
Hi people!! I´m using Perl for the first time in my Mac OS X... How can I check installed modules ??? I am running a Mac OS X Leopard 10.5.6 with Perl version v5.8.8 built for darwin-thread-multi-2level... Thanks

Re: Acepting default value for user input

2009-02-27 Thread Chas. Owens
On Fri, Feb 27, 2009 at 10:03, Sarsamkar, Paryushan wrote: snip > I would like to accept some user inputs (using ), but it might be > easier for a user if I can provide the default value, so that they just > have to press ENTER. snip > Do you want to do the normal thing? [yes] : >

Re: Acepting default value for user input

2009-02-27 Thread Gunnar Hjalmarsson
Sarsamkar, Paryushan wrote: I would like to accept some user inputs (using ), but it might be easier for a user if I can provide the default value, so that they just have to press ENTER. How can I do that? I've played around with but I cannot make it work exactly as I'd like. E

Acepting default value for user input

2009-02-27 Thread Sarsamkar, Paryushan
Hi All, I would like to accept some user inputs (using ), but it might be easier for a user if I can provide the default value, so that they just have to press ENTER. How can I do that? I've played around with but I cannot make it work exactly as I'd like. E.g. Do you

Re: assign default value to variables I assign from split

2008-05-28 Thread Richard Lee
John W. Krahn wrote: SYNOPSIS gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ] gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ] zcat [ -fhLV ] [ name ... ] Note that the -d switch applies to gzip only. zcat by definition is *supposed* to decompress files. (Why wo

Re: assign default value to variables I assign from split

2008-05-28 Thread John W. Krahn
Richard Lee wrote: John W. Krahn wrote: open FILE, "ls -tr | zcat -d $directory/$file |", or die qq/you My version of zcat does not have a -d switch, what does it do on your system? It appears that "ls -tr | " in front of zcat is superfluous? What do you think it will do there?

Re: assign default value to variables I assign from split

2008-05-28 Thread Richard Lee
John W. Krahn wrote: open FILE, "ls -tr | zcat -d $directory/$file |", or die qq/you My version of zcat does not have a -d switch, what does it do on your system? It appears that "ls -tr | " in front of zcat is superfluous? What do you think it will do there? Just to follow up

Re: assign default value to variables I assign from split

2008-05-14 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: Dr.Ruud wrote: But better stop guessing and let Richard answer. yes, variables are particular names and later I wanted to refer back by variable names. However, for now I have done this so far so I just added as array instead of breaking out by var

Re: assign default value to variables I assign from split

2008-05-14 Thread John W. Krahn
Richard Lee wrote: Dr.Ruud wrote: But better stop guessing and let Richard answer. yes, variables are particular names and later I wanted to refer back by variable names. However, for now I have done this so far so I just added as array instead of breaking out by var names.. -- code is i

Re: assign default value to variables I assign from split

2008-05-14 Thread Richard Lee
Dr.Ruud wrote: "Jenda Krynicky" schreef: Dr.Ruud: Richard Lee: [$file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25] I didn't want to put them in array since I need to use individual named variable later And why is that? Maybe because in the real cod

Re: assign default value to variables I assign from split

2008-05-14 Thread Dr.Ruud
"Jenda Krynicky" schreef: > Dr.Ruud: >> Richard Lee: >>> [$file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25] >>> I didn't want to put them in array >>> since I need to use individual named variable later >> >> And why is that? > > Maybe because in the real code they are not $file1, $file2,

Re: assign default value to variables I assign from split

2008-05-14 Thread Jenda Krynicky
From: "Dr.Ruud" <[EMAIL PROTECTED]> > Richard Lee schreef: > > > > [$file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25] > > I didn't want to put them in array > > since I need to use individual named variable later > > And why is that? Maybe because in the real code they are not $file1,

Re: want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-13 Thread Rob Dixon
Richard Lee wrote: > > Rob Dixon wrote: >> >> while () { >> my ($file1,$file2,$file3,$file4,$file5,$file6,$file10,$f`ile25,$file27) = >> map $_||'default', (split /\|/)[3,4,6,7,12,40,41,42,43,46,56,64]; >> } > > Thank you everyone. > > I like this solution the best and thanks for poi

Re: want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-13 Thread Richard Lee
ue is true and if not assign something default value (such as 'default' or 'X') ? I was doing (after the while loop) $file |= 'default' $file2 |= 'default2' $file3 |= 'default3' but I stopped and thought this cannot be so repetitious so I didn&

Re: want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-13 Thread John W. Krahn
Jenda Krynicky wrote: From: Richard Lee <[EMAIL PROTECTED]> I was doing (after the while loop) $file |= 'default' $file2 |= 'default2' $file3 |= 'default3' but I stopped and thought this cannot be so repetitious so I didn't want to but tried( I didn't want to put them in array since I need

Re: assign default value to variables I assign from split

2008-05-13 Thread Dr.Ruud
Richard Lee schreef: > [$file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25] > I didn't want to put them in array > since I need to use individual named variable later And why is that? -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-13 Thread Rob Dixon
s being given a value is true and if not > assign something default value (such as 'default' or 'X') ? > > I was doing (after the while loop) > > $file |= 'default' > $file2 |= 'default2' > $file3 |= 'default3' > > but I

Re: want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-12 Thread Jenda Krynicky
le > that's being given a value is true and if not > assign something default value (such as 'default' or 'X') ? > > I was doing (after the while loop) > > $file |= 'default' > $file2 |= 'default2' > $file3 |= 'default3&#

want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-12 Thread Richard Lee
while () { my($file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25,$file27) = (split( /\|/, $_))[3,4,6,7,12,40,41,42,43,46,56,64] } while doing above, what is the easiest way to make sure all the variable that's being given a value is true and if not assign something de

Re: default value from match

2005-04-20 Thread Chris Devers
On Wed, 20 Apr 2005, Keith Worthington wrote: > Having written the following code I am now troubled by v_feet_str or > v_inch_str being undefined. If there is no match can I return a > default value? In my case if there is no dimension then I want to > move ahead using a

default value from match

2005-04-20 Thread Keith Worthington
Hi All, I am still slugging it out. Many thanks to those that have helped me thus far. :-) Having written the following code I am now troubled by v_feet_str or v_inch_str being undefined. If there is no match can I return a default value? In my case if there is no dimension then I want to

Re: default value for input

2004-02-24 Thread Tim
ECTED]> To: [EMAIL PROTECTED] Subject: Re: default value for input Date: Tue, 24 Feb 2004 13:05:09 -0600 On Tue, Feb 24, 2004 at 07:41:46PM +0100, Anthony Vanelverdinghe ([EMAIL PROTECTED]) wrote: > Hi > > is it possible to give a default value to the input you're asking? I tried &g

Re: default value for input

2004-02-24 Thread Kenton Brede
\n"; } else { print "$prefix$url\n"; } > > >From: Kenton Brede <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Re: default value for input > >Date: Tue, 24 Feb 2004 13:05:09 -0600 > > > >On Tue, Feb 24, 2004 at 07:41:46PM +0

Re: default value for input

2004-02-24 Thread James Edward Gray II
On Feb 24, 2004, at 1:35 PM, Anthony Vanelverdinghe wrote: It works fine! So it isn't possible to show this on the screen so that the user can see it's already there and just has to complete the url?? print "Enter URL: http://";; chomp( my $input = <> ); $input = 'http://' . $input unless m!^htt

Re: default value for input

2004-02-24 Thread Anthony Vanelverdinghe
It works fine! So it isn't possible to show this on the screen so that the user can see it's already there and just has to complete the url?? Thanks Anthony _ Je horoscoop al gelezen? http://www.msn.be/horoscoop -- To unsubscribe,

Re: default value for input

2004-02-24 Thread James Edward Gray II
On Feb 24, 2004, at 1:19 PM, Anthony Vanelverdinghe wrote: Thanks! But the problem is the following: the user has to enter an url and now i want to put "http://"; always in front (and show it on the screen) so that the user doesn't have to enter this everytime. How about: chomp( my $input = <>

Re: default value for input

2004-02-24 Thread Anthony Vanelverdinghe
Thanks! But the problem is the following: the user has to enter an url and now i want to put "http://"; always in front (and show it on the screen) so that the user doesn't have to enter this everytime. From: Kenton Brede <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject:

Re: default value for input

2004-02-24 Thread Kenton Brede
On Tue, Feb 24, 2004 at 07:41:46PM +0100, Anthony Vanelverdinghe ([EMAIL PROTECTED]) wrote: > Hi > > is it possible to give a default value to the input you're asking? I tried > the code below but this didn't work. > > $URL = "http://";; > chomp

default value for input

2004-02-24 Thread Anthony Vanelverdinghe
Hi is it possible to give a default value to the input you're asking? I tried the code below but this didn't work. $URL = "http://";; chomp ($URL = $URL.<>); Thx Anthony _ De winnaars zijn gekend van d

RE: default value

2002-04-10 Thread Jeff 'japhy' Pinyan
On Apr 10, David Gray said: >> $question = $default if $question eq ''; > >You could possibly shorten this last line to: > >$question ||= $default; > >This will set $question to $default if $question logically evaluates to >false (which includes the case where $question is the empty string). If

RE: default value

2002-04-10 Thread David Gray
> $question = $default if $question eq ''; You could possibly shorten this last line to: $question ||= $default; This will set $question to $default if $question logically evaluates to false (which includes the case where $question is the empty string). If you only want to reset $question whe

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: 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

2002-04-09 Thread Michael Gargiullo
On Apr 9, Michael Gargiullo said: >While asking a few questions to run a script. How can I give a default >answer? > >print "File to use:"; >chomp(my $question = ); Most programs do it like so: my $default = "/foo/bar/blat"; print "File to use? [$default] "; chomp(my $question = ); $

RE: default value

2002-04-09 Thread Wagner-David
I usually display what the defaults are at first and then use a carriage return to signify that is what I want. You can test like: if ( $question eq '' ) { # place the default value into $question } I usually use a infinite loop and w

Re: default value

2002-04-09 Thread Jeff 'japhy' Pinyan
On Apr 9, Michael Gargiullo said: >While asking a few questions to run a script. How can I give a default >answer? > >print "File to use:"; >chomp(my $question = ); Most programs do it like so: my $default = "/foo/bar/blat"; print "File to use? [$default] "; chomp(my $question = ); $q

default value

2002-04-09 Thread Michael Gargiullo
While asking a few questions to run a script. How can I give a default answer? Right now I'm asking my question like so: print "File to use:"; chomp(my $question = ); -Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]