Re: Need help pruning data..
$value=$2*1.0; if ( ($value =10 ) || ( $value =200 ) { do_something(); } On Mon, 22 Mar 2004, Matt Bazan wrote: Date: Mon, 22 Mar 2004 15:02:12 -0800 From: Matt Bazan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Need help pruning data.. Hi all, I've got an array that contains several dozen IP addresses (along with a bunch of garbage output from running the NMAP command). I want to find the fastest, cleanest way to remove all IP address who's last octet is 10 or below and all IP addresses who's last octet is 200 or higher. I can think of several ways to do this by using reg ex's and looping through the data but am wondering if there is a faster way, or, if not, if a cleaner way than what I've come up with: my $bad_ip; my @results = `c:/perl/nmap/nmap.exe -sP -n $Subnet`; #subnet is a /24 private IP block foreach (@results) { if (/(\d+\.\d+\.\d+\.(\d+))/ { #match on IP addresses only if ($2 =~ reg ex to match numbers 10 or below or regex to match numbers 200 orgreater) { next; } else { ..do something.. } } } Thanks, Matt ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- Angelos Karageorgiou Masters of Computer Science City University of New York http://www.unix.gr ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Need help pruning data..
Matt Bazan wrote: Peter Guzis wrote: Benchmark: timing 1 iterations of use_grep_block, use_map_split, use_regex, use_rindex, use_split... use_grep_block: 8 wallclock secs ( 7.96 usr + 0.00 sys = 7.96 CPU) @ 1256.12/s (n=1) use_map_split: 10 wallclock secs ( 9.94 usr + 0.01 sys = 9.95 CPU) @ 1004.62/s (n=1) use_regex: 6 wallclock secs ( 6.14 usr + 0.00 sys = 6.14 CPU) @ 1628.93/s (n=1) use_rindex: 4 wallclock secs ( 4.04 usr + 0.00 sys = 4.04 CPU) @ 2477.70/s (n=1) use_split: 10 wallclock secs ( 9.20 usr + 0.00 sys = 9.20 CPU) @ 1086.60/s (n=1) That settles it, I'm going with rindex. Thanks for the suggestions. I've always said that the first priority should be readbility; after all that's what programming languages are for! If you find something's running too slowly then tune it up, but otherwise leave it as it is. The benchmarks differ by a factor of only just over two, and surprisingly that's about the limit of our perception of performance! That's why overclocking isn't worth it and you should only upgrade PC components if you can provide a speed or capacity increase of at least double :) Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Can a variable be made like this?
$heygoodday = how are doing you sir; $hi = $hey; $hello = $hi.goodday; Print $hello; And get the output from $heygoodday? Is this possible in perl? I need it because I now the last piece of the variable name goodday, And the first piece that I need to get from the db. So that could be different. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Can a variable be made like this?
Title: RE: Can a variable be made like this? you can do what you want, but not quite as you stated. It would be something like this: $hi = $db-lookup; # how you do this depends on your db and script $hello = ${hi}goodday; print $hello; -Original Message- From: Kenneth Lodahl (KELO, ITRC, SH) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 24, 2004 8:45 AM To: [EMAIL PROTECTED] Subject: Can a variable be made like this? $heygoodday = how are doing you sir; $hi = $hey; $hello = $hi.goodday; Print $hello; And get the output from $heygoodday? Is this possible in perl? I need it because I now the last piece of the variable name goodday, And the first piece that I need to get from the db. So that could be different. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Can a variable be made like this?
No... you [don't really] want perl -e $x='hello';${$x}='Check this';print $hello; YOU WOULD BE BETTER TO USE A HASH... Why do you need this [very unsafe] construct? Kind regards, Mark Anderson SMS Deployment The Royal Bank of Scotland 113 Dundas Street, Edinburgh, EH3 5DE http://www.manufacturing.rbs.co.uk/GTrswi/ -Original Message- From: Kenneth Lodahl (KELO, ITRC, SH) [SMTP:[EMAIL PROTECTED] Sent: Wednesday, March 24, 2004 1:45 PM To: [EMAIL PROTECTED] Subject: Can a variable be made like this? *** WARNING : This message originates from the Internet *** $heygoodday = how are doing you sir; $hi = $hey; $hello = $hi.goodday; Print $hello; And get the output from $heygoodday? Is this possible in perl? I need it because I now the last piece of the variable name goodday, And the first piece that I need to get from the db. So that could be different. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB The Royal Bank of Scotland plc is authorised and regulated by the Financial Services Authority and represents The Royal Bank of Scotland Marketing Group. The Bank sells life policies, collective investment schemes and pension products and advises only on the Marketing Group's range of these products and on a With-Profit Bond produced by Norwich Union Life (RBS) Limited. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
AW: Can a variable be made like this?
Kenneth, use this (like Mark suggested) $var{'heygoodday'} = 'how are doing you sir'; $var{'hi'} = hey; $var{'hello'} = $var{ $var{'hi'} . 'goodday' }; print $var{'hello'}; Dietmar Hamburger Berater Team GmbH Dr. Dietmar Fiehn Telefon: 040/369779-0 Stadthausbrücke 3 (Fleethof)Telefax: 040/369779-99 20355 Hamburg eMail : [EMAIL PROTECTED] -Ursprüngliche Nachricht- Von: Kenneth Lodahl (KELO, ITRC, SH) [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 24. März 2004 14:45 An: [EMAIL PROTECTED] Betreff: Can a variable be made like this? $heygoodday = how are doing you sir; $hi = $hey; $hello = $hi.goodday; Print $hello; And get the output from $heygoodday? Is this possible in perl? I need it because I now the last piece of the variable name goodday, And the first piece that I need to get from the db. So that could be different. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Can a variable be made like this?
No... you [don't really] want perl -e $x='hello';${$x}='Check this';print $hello; YOU WOULD BE BETTER TO USE A HASH... Why do you need this [very unsafe] construct? Kind regards, Mark Anderson SMS Deployment Good advice. #!perl -w use strict; my %greeting; $greeting{salutation} = hi; $greeting{welcome} = how are doing you sir; print $greeting{salutation} . . $greeting{welcome} . \n; - Lynn. -Original Message- From: Kenneth Lodahl (KELO, ITRC, SH) [SMTP:[EMAIL PROTECTED] Sent: Wednesday, March 24, 2004 1:45 PM To: [EMAIL PROTECTED] Subject:Can a variable be made like this? *** WARNING : This message originates from the Internet *** $heygoodday = how are doing you sir; $hi = $hey; $hello = $hi.goodday; Print $hello; And get the output from $heygoodday? Is this possible in perl? I need it because I now the last piece of the variable name goodday, And the first piece that I need to get from the db. So that could be different. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Yet another regex question
I'm trying to grab a website's description from the meta tags but I can't seem to make it work all the time. As people have pointed out, it's best to use a parser to parse HTML, not a regex. Here's some code (untested) as a starting point for two different parsers. # Sample HTML::Tokeparser code: $p = HTML::TokeParser-new($filename); my $desc = ; while (my $token = $p-get_tag(meta)) { if ($token-[1]{name} eq description) { $desc = $token-[1]{content}; } } # Sample XML::LibXML code (handy if you plan to do # more sophisticated parsing or XML parsing too) my $p = XML::LibXML-new()-recover(1); my $doc = $p-parse_html_file($filename); my $desc = $doc-findvalue('/html/head/meta/@content[../@name=description]'); -- Mark Thomas[EMAIL PROTECTED] Internet Systems Architect User Technology Associates, Inc. $_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Search Engine for intranet web site
Hello there, I am trying to setup a search engine for the web-site I have created. I have setup a search engine script using the File::Find module but it is really slow. Anyone know of any faster way of doing so - maybe a grep of all the files within a directory and its sub-directories for the title only to make it faster. I would like to give the user an option of searching just the title or brief description or entire contents of the file. Thank you, Sheetal ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Adding pod to the ActiveState HTML documentation
Hello, I am wondering if someone knows how to add POD documentation for a module that was installed from CPAN (and not PPM) to ActiveState Perl's HTML documentation system. I have looked through the ActiveState docs, and have not found it mentioned... I see two things that need to be done if I want to do this manually : - use pod2html to convert the POD to HTML. * I need the right CSS to make it look like ActiveState's HTML docs * I need the right command line parameters to pod2html so that the docs will link properly to other modules' documentation - add the link for the newly generated HTML file to the perltoc.html file, so that it will show up in the right-hand frame So if someone has the right command line parameters to pod2html to make it look right and link correctly, I could do the rest manually. On the other hand, if someone knows how PPM does it, so that I have an automatic way of doing it all the right way (TM), I would be happier with that... I have looked through the PPM source code, including its various modules, and haven't found anything that looked like a system(pod2html ...); call. Thanks in advance, Jean-Sébastien Guay application/ms-tnef___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Search Engine for intranet web site
Well, my search script currently parses the main directory and all its sub-directories for html files and then uses regular _expression_ to match the words user has entered for the search open(IFP, $File::Find::name) or print Search error $! :$fname br; # only if html file my $string = IFP; close(OFP); return unless ($string =~ /\Q$keywords\E/i); if ($string =~ /title(.*?)\/title/is) { $page_title = $1; } I have a feeling that this is not the most efficient way of searching for all files that contain the words the user entered in his search criteria. And it is also very slow. So I am looking for some code examples or modules I can use for the search engine so that it will be a faster. Thanks --Sheetal x.51226 -Original Message- From: Thutika, Srinivas (ODC - Satyam) [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 24, 2004 10:25 AM To: Desai, Sheetal A Subject: RE: Search Engine for intranet web site could u pls explain in little detail -Original Message- From: Desai, Sheetal A [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 24, 2004 8:42 PM To: perl-win32-users Subject: Search Engine for intranet web site Hello there, I am trying to setup a search engine for the web-site I have created. I have setup a search engine script using the File::Find module but it is really slow. Anyone know of any faster way of doing so - maybe a grep of all the files within a directory and its sub-directories for the title only to make it faster. I would like to give the user an option of searching just the title or brief description or entire contents of the file. Thank you, Sheetal == If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ == ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Adding pod to the ActiveState HTML documentation
Hi Jean-Sébastien, Fortunately, you don't need to do this manually. Copy your POD file in the Perl directory somewhere near other POD files like Perl\lib\... or Perl\site\lib\... Open a command prompt then executes this command perl -MActivePerl::DocTools -e UpdateHTML() The Html file of your POD will be generated automatically and it will be integrated into the Core Perl HTML Documentation of ActiveState. (You will see it when browsing the right-hand frame.) Hope this will work Francis Paulin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guay Jean-Sébastien Sent: Wednesday, March 24, 2004 10:26 AM To: 'Perl-Win32-Users' Subject: Adding pod to the ActiveState HTML documentation Hello, I am wondering if someone knows how to add POD documentation for a module that was installed from CPAN (and not PPM) to ActiveState Perl's HTML documentation system. I have looked through the ActiveState docs, and have not found it mentioned... I see two things that need to be done if I want to do this manually : - use pod2html to convert the POD to HTML. * I need the right CSS to make it look like ActiveState's HTML docs * I need the right command line parameters to pod2html so that the docs will link properly to other modules' documentation - add the link for the newly generated HTML file to the perltoc.html file, so that it will show up in the right-hand frame So if someone has the right command line parameters to pod2html to make it look right and link correctly, I could do the rest manually. On the other hand, if someone knows how PPM does it, so that I have an automatic way of doing it all the right way (TM), I would be happier with that... I have looked through the PPM source code, including its various modules, and haven't found anything that looked like a system(pod2html ...); call. Thanks in advance, Jean-Sébastien Guay File: ATT2877177.txt ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Adding pod to the ActiveState HTML documentation
perl -MActivePerl::DocTools -e UpdateHTML(1) Bradley K. Embree, IT Support Excel Kitchens Email: [EMAIL PROTECTED] Phone: 1.250.376.8713 Fax: 1.250.376.4511 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guay Jean-Sébastien Sent: Wednesday, March 24, 2004 7:26 AM To: 'Perl-Win32-Users' Subject: Adding pod to the ActiveState HTML documentation Hello, I am wondering if someone knows how to add POD documentation for a module that was installed from CPAN (and not PPM) to ActiveState Perl's HTML documentation system. I have looked through the ActiveState docs, and have not found it mentioned... I see two things that need to be done if I want to do this manually : - use pod2html to convert the POD to HTML. * I need the right CSS to make it look like ActiveState's HTML docs * I need the right command line parameters to pod2html so that the docs will link properly to other modules' documentation - add the link for the newly generated HTML file to the perltoc.html file, so that it will show up in the right-hand frame So if someone has the right command line parameters to pod2html to make it look right and link correctly, I could do the rest manually. On the other hand, if someone knows how PPM does it, so that I have an automatic way of doing it all the right way (TM), I would be happier with that... I have looked through the PPM source code, including its various modules, and haven't found anything that looked like a system(pod2html ...); call. Thanks in advance, Jean-Sébastien Guay File: ATT00010.txt ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs