Slash Boxes
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 ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Wednesday September 20, 2006
08:23 AM

How to know you're having a bad day

[ #31057 ]

You know you're having a bad day when the following quick hack becomes an indispensable snippet that you bind to a key in vim:

#!/usr/bin/perl -l

use strict;
use warnings;

my $file = shift or die "usage: $0 lib";

use lib 'lib';
require $file or die "Cannot require $file";

foreach my $sym ( sort keys %:: ) {
    next unless $sym =~ /^[[:word:]]+$/;
    next if $sym =~ /^[[:digit:]]$/;
    next unless `grep -l '[\@\$%]$sym' $file`;
    print $sym;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • That’s pretty terrible.

    • And it's going to get a lot worse as I expand this to match what type of variable we have. I once joked about writing Symbol::Table::Find and Symbol::Table::Grep, but now I might have to!

      Fortunately the programmers I work with are pretty sharp and our new code is much cleaner.