in reply to Passing Parameters Help!
Three random comments:
# Grab the current directory from $0. BEGIN { $0 =~ '(.*[\\\/])\w+\.\w+$'; $curr_dir = $1 || "./"; }
Probably better approach than using FindBin, but then use File::Basename to get the actual dirname().
my $display = &filter($q->param('display')) || '';
Don't use the &-form of sub call: it is obsolete and likely not to do what you mean.
sub filter { if($_[0]){ $_[0]=~s/\s+$//; $_[0]=~s/\'/\\\'/g; $_[0]=~s/<//g;
While better ways to do the same altogether have been suggested to you, when you have to do so, avoid such long chains of =~'s:
sub filter { my $str=shift; for ($str) { return '' unless $_; s/\s+$//; s/'/\\'/g; tr{<>;()\"\'?}{}d; s/<script//g; } $str; }
|
|---|