Overloading names in that way is a great way to introduce subtle bugs and make code hard to understand. If it's an array it likely contains more than one item so using a plural form of the name (@wwns) may make sense. Alternatively I'd use the slightly more generic variable name $name for the input variable.
Oh, and don't use our as a substitute for my, especially as a temporary variable - it doesn't do what you think it does and is not at all appropriate. I'd tend to rewrite the thing as:
#!/usr/bin/perl use warnings; use strict; while (1) { print "Enter the wwn: "; chomp (my $name = lc <STDIN>); last if $name eq "q"; print join (':', unpack ("(a2)*", $name)), "\n"; }
Update: s/own/our/
In reply to Re^2: Getting "un initialized value" error though variable is initialized. Please help.
by GrandFather
in thread Getting "un initialized value" error though variable is initialized. Please help.
by perl514
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |