#perl - Wed 28 Mar 2007 between 04:44 and 04:53



infithreat2: get it?
threat2infi: I thought grep returned a list, not a scalar
Randalgrep returns whatever it needs for its context
all functions are like that
everything is like that. :)
threat2how does it know?
RandalIt's Perl!
SubStackit has its ways
Randalthere's always a defined context for every expression
*alywas*
threat2how would I make my own sub do that?
Randal@foo = LIST_CONTEXT
$foo = SCALAR_CONTEXT
integralIt's a special field in the return continuation :-P
Prof_Vincelearn Perl
threat2ok
Randalthreat2 - "perldoc -f wantarray"
threat2haha
ok
H0LEHi, man
RandalHyman? :)
actionRandal prepares for a lame question
Randalprepares for a lame question
Prof_VinceGumbyBRAIN: hymen
GumbyBRAINF00li5h reads the note again / sixteen candles burn in hell.
H0LEIn my function I create a array, what 's going to be happen if I return a reference of the array?
Is there any problem, like in C?
Randalwhat does the caller do with it?
there's no problem, unlike in C. :)
Perl data structures are reference-counted
H0LEBut the array is out of scope, Isn't it be GC?
Randalso as long as a reference to the data is used, it's good
no - there's a reference
SubStackGumbyBRAIN: one for every proton in an atom of sulfur
GumbyBRAINMhm, as i thought of as well exec it directly to use atom.
Randalthe name of the array goes out of scope, but there's still anotehr path to the data
as long as there's at least one path to the data, it stays alive
H0LEThanks Randal, Is there anything I should take care when using the reference?
RandalPerl can do this because Perl is strongly typed
H0LE - have you read "perldoc perlreftut"?
H0LEThanks for the information, I will read it soon

Page: 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 113 120 

IrcArchive