develooper Front page | perl.perl5.porters | Postings from May 2012

Re: [perl #112914] suppress warning on using unquoted strings in {} in slices too

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
May 14, 2012 15:14
Subject:
Re: [perl #112914] suppress warning on using unquoted strings in {} in slices too
Message ID:
2025.1337033677@chthon
"Father Chrysostomos via RT" <perlbug-followup@perl.org> wrote
   on Mon, 14 May 2012 14:34:17 PDT: 

> Well @hash{<foo bar>} looks prettier than @hash{qw<foo bar>},
> doesn't it?

Much prettier.  I use it all the time, too.

--tom

    package UCA;

    use v5.10.1;
    use strict;
    use warnings;

    use parent "Exporter";
    our @EXPORT = <UCA{,1,2,3,4}>;

    use Unicode::Collate;

    for my $strength ( 1 .. 4 ) {
        no strict "refs";
        *{ "UCA$strength" } = sub(_) {
            state $coll = new Unicode::Collate::
                            level       => $strength, 
                            variable    => "Non-Ignorable",
                          ;
            return $coll->getSortKey($_[0]);
        };
    } 

    {
        no warnings "once";
        *UCA = \&UCA1;
    }

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About