http://qs321.pair.com?node_id=11117508


in reply to Re^2: Collapsing smaller scripts into a larger one, request for comment
in thread Collapsing smaller scripts into a larger one, request for comment

If it were me, I'd use the list of valid collections that you already have (assuming I understand your data correctly). Something like:

# Note: Still has underscsores: my @collections = map { $_ =~ s/\.txt//; $_ } grep {/^\p{uppercase}/} @collections_list; # $collection guaranteed to match one of your file names. my $collection_raw = $cgi->param('collection'); my ($collection) = grep { $_ eq $collection_raw } @collections; $collection //= 'Deafult'; # If your file names might have <>", you can still do this: $collection = encode_entities($collection); # Without underscores my @collection_labels = map { $_ =~ s/_/ /g; $_ } @collections;

Generally, it is safest to do something like this before using $collections for anything.

Good Day,
    Dean

  • Comment on Re^3: Collapsing smaller scripts into a larger one, request for comment
  • Download Code

Replies are listed 'Best First'.
Re^4: Collapsing smaller scripts into a larger one, request for comment
by Lady_Aleena (Priest) on May 30, 2020 at 19:37 UTC

    I should have had that in already! Thank you for the reminder. I did it just a tad differently, but the same result.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.8.8 on web host.

    Version control is a non-issue, I do not use it.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena