Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: context-sensitivity for selfwritten functions

by Abigail-II (Bishop)
on Jan 28, 2004 at 09:32 UTC ( #324629=note: print w/replies, xml ) Need Help??


in reply to context-sensitivity for selfwritten functions

#!/usr/bin/perl use strict; use warnings; sub func { my $context = wantarray; print "VOID" if not defined $context; return "SCALAR" if defined $context && !$context; return "LIST" if $context; } print "Context is: "; func (); print "\n"; print "Context is: ". func (); print "\n"; print "Context is: ", func (); print "\n"; __END__ Context is: VOID Context is: SCALAR Context is: LIST

Abigail

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2021-03-01 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?