NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

This node was taken out by the NodeReaper on Tue Jan 11 17:55:58 2005 (EST)
  • Comment on (duplicate, do not respond) Total Noob....

Replies are listed 'Best First'.
Re: Explanation of 'use strict;'
by friedo (Prior) on Jan 11, 2005 at 21:23 UTC
    You're getting that error because you're defining a package-global variable ($name) which is not allowed under strict. (Well, it's allowed, but it requires an explicit package name, which probably does not surprise you.)

    The way to do what you want is to create a lexical variable with my.

    #!/usr/bin/perl -w use strict; print "Hello, I am Komodo what is your name? "; my $name = <STDIN>; chomp $name; print "Hello, $name!\n";

    For more, see Coping with Scoping. Required reading for all n00bz.