in reply to Doubt in functions

It is good practice to use an explicit return from a sub. See also perldoc perlsub.

By the way, you really want to use a sigil in front of "element": $element

Also, please use separate "code" tags so it is easier for us to distinguish your code from your output and your question.

Replies are listed 'Best First'.
Re^2: Doubt in functions
by vyeddula (Acolyte) on Jul 06, 2012 at 02:42 UTC

    Thank you all for the quick response The explicit usage with return command solved my problem Thanks again