Quote:
Originally Posted by zahheb
package Employee;
sub position {
my $obj = shift;
@_ ? $obj->{position} = shift # modify attribute
: $obj->{position}; # retrieve attribute
}
i am not able to understand @_ ? : ......what does it mean??
thanks
|
learning perl myself, but as mentioned above it's c-like shorthand for an if else statement - you could of course re-write it as
if(@_)
{
$obj->{position} = shift # modify attribute
}
else
{
$obj->{position}; # retrieve attribute
}