Re: default value for input

2004-02-24 Thread Tim
At 08:19 PM 2/24/04 +0100, you 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.


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 +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 ($URL = $URL.<>);

I've set up a default variable like the following but can't vouch for
it being the proper way to do so.
my $new_uid ||= '700'; # default to 700 if it doesn't exist.
Kent
--
"Efficiency is intelligent laziness."
  -David Dunham


This has a few extra quotes escaped on behalf of Mr. Gates:

perl -e "$p='http://';print \"Enter: $p\";$t=;print $p.$t;"

or
$p='http://';
print "Enter: $p";
$t=;
print $p.$t;


Re: default value for input

2004-02-24 Thread Kenton Brede
On Tue, Feb 24, 2004 at 08:19:05PM +0100, Anthony Vanelverdinghe ([EMAIL PROTECTED]) 
wrote:

Bottom posting in the future would be much appreciated.

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

OK sorry, I'm at work and thought I saw a couple of quick questions I
could answer.  Below is another quick example of one way to handle 
what you are trying to do.  I just threw the check in there in case a
person actually typed http://http://whatever.com.  I know that isn't
very likely but . 

#!/usr/bin/perl
use warnings;
use strict;

my $prefix = 'http://';

print "Enter URL http://";;
chomp (my $url = );

if ($url =~ /http:/) {
print "$url\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 +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 ($URL = $URL.<>);
> >
> >I've set up a default variable like the following but can't vouch for
> >it being the proper way to do so.
> >
> >my $new_uid ||= '700'; # default to 700 if it doesn't exist.
> >Kent
> >
> >--
> >"Efficiency is intelligent laziness."
> >  -David Dunham


-- 
"Efficiency is intelligent laziness."
  -David Dunham

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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!^http://!;
James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



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 = <> );
$input = 'http://' . $input unless m!^http://!;
Hope that helps.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



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
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
> the code below but this didn't work.
>
> $URL = "http://";;
> chomp ($URL = $URL.<>);

I've set up a default variable like the following but can't vouch for
it being the proper way to do so.
my $new_uid ||= '700'; # default to 700 if it doesn't exist.
Kent
--
"Efficiency is intelligent laziness."
  -David Dunham
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

_
Ben jij klaar voor De Vuilbek? http://devuilbek.msn.be/start.php Nu op JIM 
en MSN

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



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 ($URL = $URL.<>);

I've set up a default variable like the following but can't vouch for
it being the proper way to do so.

my $new_uid ||= '700'; # default to 700 if it doesn't exist.
Kent

-- 
"Efficiency is intelligent laziness."
  -David Dunham

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 de fotoromanwedstrijd 
http://www.msn.be/valentijn/wedstrijd/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]