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.
@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'
...@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.
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
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:
>
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
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 =
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
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
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.
>>
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
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] :
>
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
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
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
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?
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
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
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
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
"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,
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,
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
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&
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
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
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
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
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
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
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
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
\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
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
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,
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 = <>
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:
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
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
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
> $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
> 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
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') ||
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 = );
$
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
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
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]
47 matches
Mail list logo