Advertisement
paperline27

cari-kata.pl

Jan 19th, 2024 (edited)
2,021
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.67 KB | Cybersecurity | 0 0
  1. use strict;
  2. use warnings;
  3.  
  4. # Mendapatkan daftar file text dalam direktori
  5. my @perl_files = glob("*.txt");
  6.  
  7. # Loop melalui setiap file
  8. foreach my $file (@perl_files) {
  9.     open my $fh, '<', $file or die "Tidak dapat membuka file '$file': $!";
  10.  
  11.     # Loop melalui setiap baris dalam file
  12.     my $line_number = 0;
  13.     while (my $line = <$fh>) {
  14.         $line_number++;
  15.  
  16.         # Cari kata kunci dalam setiap baris
  17.         if ($line =~ /\bpicoCTF\b/i) {
  18.             print "File: $file, Baris: $line_number - $line";
  19.         }
  20.     }
  21.  
  22.     close $fh;
  23. }
  24.  
  25.  
  26. =begin comment
  27. 1.extension file .txt bisa dirubah menjadi apapun
  28. 2. kata picoCTF bisa dirubah menjadi apapun
  29. =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement