Advertisement
GregLeblanc

Untitled

Mar 15th, 2024
1,151
0
120 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.52 KB | Fixit | 0 0
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use warnings;
  4. use HTML::TokeParser;
  5.  
  6. my $script = "/var/www/cgi-bin/findenergy";
  7.  
  8. my $scriptoutput = `$script -debug particle=ALPHAS frequency=17.88 charge="+2"`;
  9.  
  10. my $p = HTML::TokeParser->new(\$scriptoutput);
  11. my @energy = ();
  12.  
  13. while (my $token = $p->get_tag("th")) {
  14.     if($token->[1]{id}) {
  15.        if($token->[1]{id} =~ /energy/){
  16.             my $text = $p->get_trimmed_text("/a");
  17.             @energy = split ' ', $text;
  18.             print "$energy[2]\n";
  19.        }
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement