Modul Recursive Directory
Dulu sebelum nemuin modul ini, untuk baca atau pengecekan suatu file yang ada dalam sub-sub direktory aku menggunakan fungsi recursive yang lumayan agak panjang. Tapi untung nya setelah nemuin nih modul, untuk baca file yang ada didalam sub-sub direktory terasa begitu mudah. Berikur contoh scriptnya :
#!/usr/bin/perl
use strict;
#--Modul Recursive Directory--
use File::Find;
my($Group, $Text) = @ARGV;
my $Spool = "/var/spool"; # or wherever your newsspool lives
$| = 1; # so we can see it run
find(\&Kibo, "$Spool/$Group");
sub Kibo
{
-d and print "$_\n";
-f and /^\d+$/ or return;
print "$_\r";
open(ARTICLE, $_) or return;
my @lines = ();
for my $line (@lines)
{
$line =~ /$Text/o and print $line;
}
}
#!/usr/bin/perl
use strict;
#--Modul Recursive Directory--
use File::Find;
my($Group, $Text) = @ARGV;
my $Spool = "/var/spool"; # or wherever your newsspool lives
$| = 1; # so we can see it run
find(\&Kibo, "$Spool/$Group");
sub Kibo
{
-d and print "$_\n";
-f and /^\d+$/ or return;
print "$_\r";
open(ARTICLE, $_) or return;
my @lines = ();
for my $line (@lines)
{
$line =~ /$Text/o and print $line;
}
}
.."..Blogging : Programing.."..
Komentar
mmmhh mau minta tolong nie:)gie bingung ma tugas perancangan sistem minimum tentang trafic light, pake microcontroler.bisa minta spesifikasi dari pemrogramannya g?
makacih
wss
was searching on Aol for something else, Nonеtheless I am heгe now
and would just liκe to say thank уou for a tremеndous post anԁ a all round еnjoyable blog (I also love the theme/design), I don’t have
time to go through it all at the moment but Ӏ hаve saνed it anԁ
alѕo аdded іn your RSS feeds,
so when Ι hаνe time Ι will be back to гead much
morе, Pleaѕe do kеep up the aωesomе jo.
my web ѕitе; Power Rating
blog thгοugh Googlе, and found thаt it's really informative. I'm
going to watсh out for brussels. I'll appreciate if you continue this in future. Many people will be benefited from your writing. Cheers!
Look into my blog :: Lungenforum.Jjays.Info
My page: ohms law
is the top blogging platfогm out therе right noω.
(frοm what I've read) Is that what you are using on your blog?
Feel free to surf to my web page varistor
folks you really гecognize what you are talking approximatеlу!
Bоoκmarked. Plеase also consult with my web site =).
We could havе a link exchange аgreement between
us
Here is my homepаge ... trimmer cermet
main to intеrest the ѵiewегs tο go to ѕеe the ωeb pаge, that's what this web site is providing.
My web blog ... power rating
this webѕite who has shaгeԁ this fantastic агticle
at at thіs plасe.
Feel fгеe tο visit my page power rating
Visit my web blog: power rating resistor
upon thіs I've discovered It absolutely useful and it has aided me out loads. I am hoping to give a contribution & help other customers like its helped me. Good job.
My blog post ... Resistor color code calculator
κeер vіѕiting thіѕ web site and be updated with the
most uр-to-date information ρosted hеre.
Feel frеe to ѕurf tο my weblog -
wire-wοund resistor ()