I have some pretty technical Q's for something I'm trying to write, if anyone here knows alot of perl let me know and I can try and bore you with what I'm trying to accomplish...
[ms] · Est. May 2002
Music madethis place,we just kept itgoing...
One durable person. One social graph. Many communities—and every way people speak, share, listen, write, gather and remember.
Forums / Computers / Electronics / Games
Any perl geeks here?
Re: Any perl geeks here?
Yo Stefhen, a work mate I know is a Perl crack. If you send me your questions and if you are not talking about a boat load of questions, I can forward them to him. Just drop me a PM or E-Mail.
Re: Any perl geeks here?
Python FTW ;)
Re: Any perl geeks here?
i havent tried python yet, want to but havent gotten to it. i'm really liking ruby at the moment. perl regexp's > all though.
where else can you do this?
[code] sub parse_html { foreach (map {$host_files{$}} sort keys %host_files) { open(HOST_LIST, "<$");
while(<HOST_LIST>) {
chomp;
s/(.*?)\..*/$1/;
$host = $_;
if(open(HOST, sprintf("</webdocs/guts/sysrpt/$host/%04d%02d%02d.html",
sub {($_[5]+1900, $_[4]+1, $_[3])}->(localtime(time()-24*60*60))))) {
while(<HOST>) {
if(/NAME.*cmd58/ .. /cmd59/) {
s/<[^>]*>//gs;
if(/^dg rootdg/ .. /^Disk group/) {
if(/^pl /) {
if(/ENABLED/) {
s/.*? (.*?) .*/$1/;
s/rootdisk-B0//;
s/(.*?)-.*/$1/;
chomp;
push @{$vxprint{$host}}, $_;
}
}
}
}
}
close(HOST);
}
}
close(HOST_LIST);
} } [/code]:lol:
Re: Any perl geeks here?
^^^ :lol:
Pretty sure that if I could ever figure out what you were trying to do there I could do it in half the number of lines with python and about 10 times more readable (comments??):lol: But then I am pretty biased. Must be a reason so many people use perl. Shame I don't have time to pick anything up at the moment and python has made me super lazy :p
Also: [code]import re[/code] gives you all the regular expressions you could ever want :D
Re: Any perl geeks here?
yeah i just hacked that together for something at work and no one else is going to mess with it so i didnt bother to comment it :lol:
people rave about python, ive tried a bit to learn but havent yet, i guess maybe because of the whole syntax thing and sensitive indenting was just too different at the time and i didnt pick up on it.
Ruby is pretty cool, it is great how quick I can get things done in so little code and EVERYTHING is an object:
"3".class => String "3".to_i => 3 "3".to_i.class => Fixnum
Re: Any perl geeks here?
I concur