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<agapov.sl...@gmail.com> 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 serious
programs as much as possible because it can get devastated too easily.

print "Enter number:";

An English typo "Enter number" should be "Enter a number".

chomp($number =<>);
if ( $number = /[0-9]/) {

This is wrong.

It is not "wrong", in the sense that the syntax is correct, it just does something different than what the OP intended.


You should use "=~" (the pattern match operator)

m// is the pattern match operator, "m" stands for match. =~ is the binding operator, it binds the left operand to the right operand.




John

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to