Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Memorizing The s/// Option List For Fun and Profit

by QM (Vicar)
on May 23, 2013 at 12:34 UTC ( #1034937=perlmeditation: print w/ replies, xml ) Need Help??

Did you ever want to memorize the s/// option list? The full list (from perlop) is msixpodualgcer.

Here are some anagrams I found:
* discourage p/m/xl (petite, medium, extra-large)
* glamorised x cpu
* Proclaimed, "g sux!" (oft heard?)
* xl CPU ideograms (extra-large CPU)
* goru x misplaced ("guru is misplaced")
* ex-cpu marigolds
* dog pux miracles (poo or pukes)

Can anyone come up with something better?

-QM
--
Quantum Mechanics: The dreams stuff is made of

Comment on Memorizing The s/// Option List For Fun and Profit
Select or Download Code
Re: Memorizing The s/// Option List For Fun and Profit
by tobyink (Abbot) on May 23, 2013 at 15:02 UTC

    Take a peek at the source code for B::Deparse, a module that takes an in-memory Perl optree and outputs a string of Perl source equivalent to it. Given the /g /i, /m and /r modifiers, it could easily output something like: s/foo/bar/gimr but instead, with typical Perl finesse, it will, if possible, rearrange the modifiers to form a word: s/foo/bar/grim.

    The list of words it will try is repeated below...

    my %matchwords; map($matchwords{join "", sort split //, $_} = $_, 'cig', 'cog', 'cos', + 'cogs', 'cox', 'go', 'is', 'ism', 'iso', 'mig', 'mix', 'osmic', 'ox', 'sic +', 'sig', 'six', 'smog', 'so', 'soc', 'sog', 'xi'); # ... my %substwords; map($substwords{join "", sort split //, $_} = $_, 'ego', 'egoism', 'em +', 'es', 'ex', 'exes', 'gee', 'go', 'goes', 'ie', 'ism', 'iso', 'me', 'meese', 'meso', 'mig', 'mix', 'os', 'ox', 'oxime', 'see', 'seem', 'seg', 'sex', 'sig', 'six', 'smog', 'sog', 'some', 'xi', 'rogue', 'sir', 'rise', 'smore', 'more', 'seer', 'rome', 'gore', 'grim', 'g +rime', 'or', 'rose', 'rosie');
    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
      I must say, I'm a bit disappointed ;) Leaving out obvious wins like "miracles" and "ideograms"?

      And I realize I forgot to try more e's. Heck, I suppose technically all of them can be repeated. Trying a bit harder and a bit looser, there's magicexposure, geodesicmap, supermelodic, and my favorite so far, maliciouspleasure.

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

        Bear in mind that some regexp modifiers are mutually exclusive; for example /a which imposes ASCII semantics on the string being matches, and /l which imposes locale semantics on it. Thus s/foo/bar/miracles is a compile time error.

        Here's a quick script to find allowable words...

        #!/usr/bin/env perl use v5.18; open my $dict, "<", "/usr/share/dict/words"; while (<$dict>) { next unless /^[msixpodualgcer]+$/; chomp; my $ok = do { my $testing = $_; local $_; # protection eval "s/foo/bar/$testing; 1"; }; say if $ok; }

        I rather like these ones:

        • amigos
        • carcass
        • circus
        • corridor
        • crisscross
        • gigolo
        • girls
        • idiom
        • igloo
        • macrocosm
        • macroscopic
        • mammograms
        • microcosm
        • microscopic
        • orgasmic
        • pompous
        • program
        • sarcasm
        • scissors

        Now to find a way to patch B::Deparse...

        package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1034937]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2014-10-30 16:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls