On Jan 11, 2008 3:03 PM, ciwei <[EMAIL PROTECTED]> wrote: > Question from a newbie: how to properly use space > when reference to variables, array, hash etc.
Don't put any spaces inside a variable name, especially when interpolating it. > print "first line : $user => @{$ttys {$user}} \n"; > print "second line: $user => @ {$ttys { $user}} \n"; > print "third line: $user => @{$ttys{$user}} \n"; Because of the spaces, the first two use $ttys (a scalar) while the third uses %ttys (a hash). Although Perl is willing to silently ignore some whitespace within a variable in ordinary code, quoted whitespace is significant. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/