Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Context aware functions - best practices?

by ihb (Deacon)
on Jan 15, 2003 at 22:40 UTC ( #227255=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      return wantarray ? @arr : $arr[-1];
  2. or download this
      return @arr[0..$#arr];
  3. or download this
      my ($x) = foo(...);
  4. or download this
      sub get_headers {
        my $self = shift;
        my @headers = @_;
    ...
        my @values = @{$self->{headers}}{@headers};
        return @values;
      }
    
  5. or download this
      my ($recipient, $sender) = $obj->get_headers('to', 'from');
  6. or download this
      my ($recipient) = $obj->get_headers('to');
  7. or download this
      return wantarray ? @values : $values[0];
  8. or download this
      my $recipient = $obj->get_headers('to');
  9. or download this
      my $recipient = $obj->get_headers('to', 'from');
  10. or download this
      return @results if wantarray;
      carp("More than one value in result in scalar context")
        if @results > 1;
      return $results[0];
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://227255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2014-07-22 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (116 votes), past polls