Hi:
I have a global to return a random category name, and I want to use it for linking to the category. I have a working global like this:
sub {
no strict;
my $count = int(rand($DB->table('Category')->count)) || 1;
my $link = $DB->table('Category')->select( { ID => $count }, ['Full_Name'] )->fetchrow;
$link =~ s/\s/_/g;
$link =~ s/\./_/g;
$link =~ s/&/_/g;
$link =~ s/\?/_/g;
$link =~ s/!/_/g;
$link =~ s/\*/_/g;
$link =~ s/'/_/g;
$link =~ s/\(/_/g;
$link =~ s/\)/_/g;
$link =~ s/:/_/g;
$link =~ s/,/_/g;
return $link;
}
I guess you can see why I want to clean it up.... all those subsitutions- while neccisary- are ugly. I was wondering if this is the same thing:
and will that work?
Thanks!
dave
Big Cartoon DataBase
Big Comic Book DataBase
I have a global to return a random category name, and I want to use it for linking to the category. I have a working global like this:
Quote:
sub {
no strict;
my $count = int(rand($DB->table('Category')->count)) || 1;
my $link = $DB->table('Category')->select( { ID => $count }, ['Full_Name'] )->fetchrow;
$link =~ s/\s/_/g;
$link =~ s/\./_/g;
$link =~ s/&/_/g;
$link =~ s/\?/_/g;
$link =~ s/!/_/g;
$link =~ s/\*/_/g;
$link =~ s/'/_/g;
$link =~ s/\(/_/g;
$link =~ s/\)/_/g;
$link =~ s/:/_/g;
$link =~ s/,/_/g;
return $link;
}
I guess you can see why I want to clean it up.... all those subsitutions- while neccisary- are ugly. I was wondering if this is the same thing:
Quote:
and will that work?
Thanks!
dave
Big Cartoon DataBase
Big Comic Book DataBase