in reply to Extract variables from file (split? regex? backflip?)

The easy (and wrong solution) is to use a regex on that.

use strict; use warnings; my %scalars; # This is the long and wordy version of the line that follows this whi +le loop. while ( my $line = <> ) { my @scalars_on_this_line = ( $line =~ /(\$\w+)/g ); foreach my $scalar ( @scalars_on_this_line ) { $scalars{ $scalar } = 1; } } # This is the faster (because of the hash slice )and smaller (undef va +lues instead of lots of '1' values) method. I'd write it this way. @scalars{ /(\$\w+)/g } = () while <>; $\ = $, = "\n"; print sort keys %scalars;

The harder method would be to use something like B::Xref on your data. Try doing perl -MB::Xref somescript.pl and seeing how that works for you.