Subject: Re: perl and pattern 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.slava@xxxxxxxxx> 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-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/ |