in reply to passing variables from user defined function when use strict

A my variable can't be used outside of the block (the enclosing braces) in which it's declared. When a subroutine returns a value (or values), there has to be another variable to take up those values. In other words, your return @db needs the function call to be my @db = get_all_records()

Note that the @db inside the function is completely different to the @db outside the function. It just happens to have the same name.

dominus wrote a classic tutorial on this subject. See Coping with Scoping.

Replies are listed 'Best First'.
Re^2: passing variables from user defined function when use strict
by onegative (Scribe) on Aug 20, 2007 at 21:07 UTC
    Thanks and good reading...I was having a brian f@rt...
    I should have assigned the function to the array variable instead of expecting the @db to be the same variable...
    Thanks for your help...