Any perl geeks here?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • res0nat0r
    Someone MARRY ME!! LOL
    • May 2006
    • 14475

    Any perl geeks here?

    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...
  • TomTom
    Paging Doctor Weeds...we have a shortage on 1st St.
    • May 2002
    • 16206

    #2
    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.

    Comment

    • demonAfro
      Are you Kidding me??
      • Jun 2004
      • 3488

      #3
      Re: Any perl geeks here?

      Python FTW

      Comment

      • res0nat0r
        Someone MARRY ME!! LOL
        • May 2006
        • 14475

        #4
        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);
          }
        }

        Comment

        • demonAfro
          Are you Kidding me??
          • Jun 2004
          • 3488

          #5
          Re: Any perl geeks here?

          ^^^

          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??) 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

          Also:
          Code:
          import re
          gives you all the regular expressions you could ever want

          Comment

          • res0nat0r
            Someone MARRY ME!! LOL
            • May 2006
            • 14475

            #6
            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

            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

            Comment

            • floridaorange
              I'm merely a humble butler
              • Dec 2005
              • 29114

              #7
              Re: Any perl geeks here?

              I concur

              It was fun while it lasted...

              Comment

              Working...