daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Oct 19th, 2018 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. use POSIX qw(SIGALRM);
  7. POSIX::sigaction(SIGALRM,
  8.                  POSIX::SigAction->new(sub { die "alarm" }))
  9.     or die "Error setting SIGALRM handler: $!\n";
  10.  
  11. #use Perl::Unsafe::Signals;
  12.  
  13. my $regexp = '(a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?)(\1)b';
  14.  
  15. my $str = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab';
  16.  
  17. my @results = ();
  18. eval {
  19.     alarm(1);
  20.  
  21.     local $SIG{ALRM} = sub { die "alarm\n" };
  22.  
  23.     @results = $str =~ /$regexp/;
  24.  
  25.     alarm(0);
  26. };
  27. warn $@ if $@;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top