Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.64 KB | None | 0 0
  1. # Prescan lines for already defined variables and put some dollar signs in
  2.     # Very hacky as there is no catch-all case
  3.     while ($line =~ m/\s+([\w]+)\s*/g) {
  4.         my $match = $1;
  5. #       print "Match: $match\n";
  6.         chomp($match);
  7.         if (defined($variables{$match})) {
  8.             if ($line =~ /\s{1}$match\s{1}/g) {
  9. #               print "Condition 1 satisfied for $match\n";
  10.                 $line =~ s/ $match / \$$match /g;
  11.                 print "$line\n";
  12.             } elsif ($line =~ /$match[\w]{1}/g) {
  13. #               print "Condition 2 satisfied for $match\n";
  14.                 $line =~ s/ $match/ \$$match/g;
  15.             } else {
  16. #               print "Condition 3 satisfied for $match\n";
  17.                 $line =~ s/$match/\$$match/g;
  18.             }
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement