2012/2/23 Rob Dixon
>
> Negative numbers aside, it seems more straightforward to insist that
> there are no non-digit numbers in the input, hence
>
That's definitely an option, but I'm not in favor of 'double negation'
conditionals usually, as they might be confusing.
For example, I use only wh
On 22/02/2012 20:48, Igor Dovgiy wrote:
TL;DR: the core of your program may be rewritten as...
print 'Please, enter an integer number, as I really need it: ';
chomp (my $user_input =);
if ($user_input =~ /^-?\d+$/) {
print "My hero! You've actually entered<$user_input>, which is an
integer!
...Well, there were no 'only latin number symbols are allowed in user
input' clauses, so \d seems to be more suitable than mere [0-9]. And
for most of my cases \d was sufficient yet shorter than [0-9] - and more
readable, somewhat ironically...
There goes 'why' part. ) And we both, I suppose, may
On 2012-02-22 21:48, Igor Dovgiy wrote:
Anyway, if you're looking for integers only, as assumed previously, the
corresponding check should be made of this:
*match the beginning of the line marker, then, optionally, a minus sign,
then any number of digits, then the end of the line marker*, or jus
What a pleasant thread we've got here. ) Suppose a bit of my ranting won't
spoil it much, will it? ))
2012/2/21 Vyacheslav
> I'm new in perl and have many questions.
>
And there's a place to ask them, believe me. )
> This my first programm.
>
Going straight to the point, I see... Good.
But i
Hello there.
Thank you. Deal with all
22.02.2012 05:11, John W. Krahn пишет:
Shlomi Fish wrote:
On Tue, 21 Feb 2012 23:47:39 +0400
Vyacheslav wrote:
I'm new in perl and have many questions.
This my first programm.
#!/usr/bin/perl
use strict;
use warnings;
That's good.
my $number = 0;
Shlomi Fish wrote:
On Tue, 21 Feb 2012 23:47:39 +0400
Vyacheslav wrote:
I'm new in perl and have many questions.
This my first programm.
#!/usr/bin/perl
use strict;
use warnings;
That's good.
my $number = 0;
my $_ = 0;
You shouldn't use my with "$_" and you should avoid using $_ in
Gentlemen, you're both running towards the line marked "on topic for
perl-beginners" at a rapid pace. I urge you to consider further messages in
this thread carefully, lest that line be crossed.
thanks,
the list mom.
--
John SJ Anderson / geneh...@genehack.org
Hello Rob,
On Tue, 21 Feb 2012 20:32:19 +
Rob Dixon wrote:
> On 21/02/2012 19:57, Shlomi Fish wrote:
> > Hi,
> >
> > On Tue, 21 Feb 2012 23:47:39 +0400
> > Vyacheslav wrote:
> >
> >> Hello.
> >>
> >> I'm new in perl and have many questions.
> >>
> >> This my first programm.
> >>
> >> #!/usr
On 21/02/2012 19:57, Shlomi Fish wrote:
Hi,
On Tue, 21 Feb 2012 23:47:39 +0400
Vyacheslav wrote:
Hello.
I'm new in perl and have many questions.
This my first programm.
#!/usr/bin/perl
use strict;
use warnings;
That's good.
my $number = 0;
my $_ = 0;
You shouldn't use my with "$_"
On 21/02/2012 19:47, Vyacheslav wrote:
Hello.
I'm new in perl and have many questions.
This my first programm.
#!/usr/bin/perl
use strict;
use warnings;
my $number = 0;
my $_ = 0;
print "Enter number:";
chomp($number = <>);
if ( $number = /[0-9]/) {
print "you number $number\n"
}
./firsh.pl
On 02/21/2012 01:47 PM, Vyacheslav wrote:
Hello.
I'm new in perl and have many questions.
This my first programm.
#!/usr/bin/perl
use strict;
use warnings;
EXCELLENT START!
my $number = 0;
my $_ = 0;
print "Enter number:";
chomp($number = <>);
if ( $number = /[0-9]/) {
You want the matc
Hi,
On Tue, 21 Feb 2012 23:47:39 +0400
Vyacheslav wrote:
> Hello.
>
> I'm new in perl and have many questions.
>
> This my first programm.
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
That's good.
> my $number = 0;
> my $_ = 0;
You shouldn't use my with "$_" and you should avoid
Hello.
I'm new in perl and have many questions.
This my first programm.
#!/usr/bin/perl
use strict;
use warnings;
my $number = 0;
my $_ = 0;
print "Enter number:";
chomp($number = <>);
if ( $number = /[0-9]/) {
print "you number $number\n"
}
./firsh.pl
Enter number: 23
I thought, what print
14 matches
Mail list logo