in reply to Problem creating a function
Note that function prototypes don't work in perl like in C or PHP code. You can't say sub cleaner( $dirty ) and expect the function to contain a variable called $dirty with your input parameter - you have to pull it off the magic @_ parameter array using shift or the syntax I use here.sub cleaner { my ( $text ) = @_; $text =~ s/\n/<br>/gs; $text =~ s/\t/ /g; return $text; } my $details = cleaner( $clean_me );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Problem creating a function
by jdporter (Paladin) on Dec 24, 2002 at 22:13 UTC |