in reply to Interesting unary - oddity
I guess my question is "But why???". This doesn't seem to serve any useful purpose, does it? For instance, if you change the script to read
It's used mostly for unordered function parameters:
$x = Dog->new( -size => 'small', # ok, this would be -aggresiveness => 'low', # quoted by =>, and -hair_style => 'curly', # ... -hair_lenght => 'short', ) package Dog; sub new { my %args = @_; my $size = $args{-size}; # ... these would be my $age = $args{-age}; # quoted by the {}, but ... my %hair_properties = @args{ -hair_style, # ... these would need -hair_lenght, # quoting without -hair_colour, # unary-'-'. }; ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Interesting unary - oddity
by hardburn (Abbot) on Aug 27, 2004 at 18:14 UTC | |
by ikegami (Patriarch) on Aug 27, 2004 at 18:38 UTC |