On Tue, Jul 31, 2001 at 11:41:30PM -0700, Richard Soderberg wrote: : > From: Jeff 'japhy/Marillion' Pinyan [mailto:jeffp@crusoe.net] : > Subject: [PATCH op.c] \? prototype : > On Jul 29, Arthur Bergman said: : : > >A \($|@|%) prototype or something like that taking a : > reference to anything : > >would be a very very very welcome addition. : : > How about a \? prototype, which automatically takes a : > reference? Then the : > user can decide, inside the function, what to accept? Patch : > below sig. : : +1 to this idea - I like the idea of being able to force any generic : argument into the subroutine as a reference. That feels right, somehow. My +1 as well. Imagine, if you will: use subs 'chomp'; sub chomp(\?) { my $ref = shift; if ( $ref ) { if ( ref($ref) eq 'SCALAR' ) { chomp( $$ref ); } elsif ( ref($ref) eq 'ARRAY' ) { chomp foreach @$ref; } elseif ( ref($ref) eq 'HASH' ) { chomp foreach values %$ref; } } else { chomp $_; } } chomp( %foo ); __END__ Casey West -- Shooting yourself in the foot with Cray You shoot yourself in the foot with an Uzi.Thread Previous | Thread Next