Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of jjore (6662)

Monday August 14, 2006
06:50 PM

Fetching -F is surprisingly obnoxious

[ #30631 ]

It is surprisingly obnoxious to fetch the value passed in to perl's -F command line parameter. Icky. Also possible is just reading from the interpreter variable PL_minus_f but that takes XS. The following is the plain perl version.

use B 'main_root';
use List::Util 'reduce';
sub _minus_f {
    my $minus_f;
    eval {
        my $op = reduce { $a->$b } main_root, split ' ', <<'OPTREE';
          first
          sibling
          sibling
             first
             sibling
                first
                   first
                   sibling
                      first
                      sibling
                         first
                            first
                            sibling
                               first
OPTREE
 
        $minus_f = $op->precomp;
    };
 
    return $minus_f;
}

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.