in reply to Functions (Return V Print)

The script part you show is working:

my $n= x('AUbla bla bla bla'); print $n; sub x { my @fucntion64= @_; foreach my $j (@fucntion64) { if(substr($j,0,2) eq "AU") { my($item,$title) = split(' ',substr($j,2),2); return $title."<br />"; } } } # prints bla bla bla<br />

Did you notice that you wrote fucntion64 instead of (I assume) function64?

Replies are listed 'Best First'.
Re^2: Functions (Return V Print)
by packetstormer (Monk) on Feb 04, 2011 at 14:30 UTC
    That was a typo in the post and not the code. Sorry for the confusion. When I use this syntax in my code I do get $title but it just prints one, and not foreach. If you know what I mean.
      If you want to collect all titles and use them in your main program, just store them in an array (use push for that) and return the array after(!) the foreach loop.