Context and Subroutines : Context « Subroutine « Perl






Context and Subroutines

   

@now = localtime;  # List context
print "@now\n";   # Scalar context

$now = localtime;
print "$now\n";

print localtime, "\n"; # prints in list context
print scalar localtime,"\n"; # Forced to scalar context

   
    
    
  








Related examples in the same category

1.Return value based on context
2.Scalar and list Context
3.Wantarray function.