It would be neat if one could tell the perl compiler: "all text from the fat-comma to the semicolon is a bunch of whitespace separated words, I just dont feel like putting qw() or '' around them, you do it. So that
$p += cs_req => qw(basic_cs math_req); $p += basic_cs => qw(intro_rec comp_org adv_prog); $p += intro_req => 'intro_cs'; $p += intro_req => qw(introI introII);
could be written as
$p += cs_req => basic_cs math_req; $p += basic_cs => intro_rec comp_org adv_prog; $p += intro_req => intro_cs; $p += intro_req => introI introII;
If anyone is bored and wants to write this (a simple source filter should do it), please let me know when it's done.

UpdateHowever the attempt to use an entire list as the second argument to a binary operator with overload failed: the first argument is the object ($p) and second argument is the first value of the list and the rest of the list is ignored... so I guess I will revert to a less fancy way of doing this:

$p->assert(cs_req => qw(basic_cs math_req));

Replies are listed 'Best First'.
Re: use mode quotewords; # someone write it
by tadman (Prior) on Jul 31, 2001 at 12:44 UTC
    The first question that springs to mind is why you can't just read this out of a file, the syntax of which you could define so easily. Then there's no requirement for all the qw-stuff.

    Secondly, since you can read it in from a file so easily, you could just as easily read it in from a here document using the same parser.

    Or, if you're feeling energetic, you can "cheat" by feeding a list to a function which returns a hash (ref?):
    %p = fix qw [ cs_req => basic_cs math_req basic_cs => intro_rec comp_org adv_prog intro_req => intro_cs introI introII ];
    Converting from this list to a hash is a quick sub that uses map, perhaps. It's probably even Golf-able.