Re: Fwd: Parsing web pages

2017-03-03 Thread Dave Gray
The submodules WWW::Mechanize::Firefox or WWW::Mechanize::PhantomJS are worth a look too, depending on the complexity/js-heaviness of the pages you're parsing and what your setup looks like exactly (full headless; on your computer, etc). On Fri, Mar 3, 2017 at 1:39 AM, Lars Noodén

Re: How to split a large string with repeating delimiters into multiple substrings

2007-05-25 Thread Dave Gray
Hi Michael, On 5/23/07, Michael Goopta [EMAIL PROTECTED] wrote: How can I split the below string and get the multiple web-addresses in a list: (i.e. the strings between upsl-url and /upsl-url

Re: Retrieving a web resource (GET) for parsing

2007-04-06 Thread Dave Gray
On 4/6/07, yitzle [EMAIL PROTECTED] wrote: If I want to parse a few web pages, what's the best way to retrieve them? Should I just run `wget $url`? LWP can do this for you. http://search.cpan.org/~gaas/libwww-perl-5.805/lib/LWP.pm If you want more complicated interactions, WWW::Mechanize is

Re: removing special characters

2007-04-04 Thread Dave Gray
On 4/4/07, Michael Gargiullo [EMAIL PROTECTED] wrote: I have a log file I'm parsing that has special characters at the end of each row. In vi it appears to be ^@ I've already tried chomp and s/\^\@// Neither work. Does any one have any ideas? You can match what vi(m) displays as '^@'

Re: File::Find again

2007-03-26 Thread Dave Gray
On 3/25/07, Alan [EMAIL PROTECTED] wrote: On Sunday 25 March 2007 18:14, Matt Herzog wrote: This is all I needed. I swear I had /($searchstring)/; in there at some point before . . . so if I pass it -s \.properties$ at the command line, it works as expetcted. Nice. That might be a

Re: Checking for infinite loops

2007-01-09 Thread Dave Gray
On 1/8/07, hOURS [EMAIL PROTECTED] wrote: Hi everyone, Jay offered me the following code to help with something. I don't undertand it, but tried to use it anyway to see if it would work. The computer told me there was a syntax error in the area I highlighted in color. I can't find it

Re: HoHoH

2007-01-09 Thread Dave Gray
On 1/9/07, oryann9 [EMAIL PROTECTED] wrote: I have a HoHoH structure that looks like after running print Dumper (\%hash); 'prlhNSSA' = { '1499' = { 'gecos' = 'First Name Last Name,CIS,location,

Re: win32::guitest

2007-01-05 Thread Dave Gray
On 1/5/07, MGautam [EMAIL PROTECTED] wrote: Hi, How do we use win32::guitest to get a particular content of the webpage into a variable. I have a task: 1) open a browser 2) hit the url 3) hit few tabs and fill the required information then submit the form 4) after submit, it leads to new page.

Re: time limited STDIN

2007-01-04 Thread Dave Gray
On 1/4/07, Saurabh Singhvi [EMAIL PROTECTED] wrote: Hi all, I wanted to know a way of taking a time limited STDIN. Say for eg after 3 seconds, the STDIN should stop waiting and move forward. How do I do this?? I was trying with unless ($child) { sleep($waittime); `echo \n`;

Re: How to pull Text from a PDF using Perl?

2007-01-04 Thread Dave Gray
On 1/4/07, Wagner, David --- Senior Programmer Analyst --- WGO [EMAIL PROTECTED] wrote: I need to look at the text from page 1 of a couple of thousand pdf's and do a regex on searching for the data. Before sending I tried a number of other things, but either died or showed me

Re: Other ways to assign a filehandle to a variable?

2006-07-27 Thread Dave Gray
For posterity: http://perl.plover.com/local.html#3_The_First_Class_Filehandle_Tr -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: MySQL question

2006-07-24 Thread Dave Gray
On 7/21/06, Karjala [EMAIL PROTECTED] wrote: Maybe I should ask this question on a database list, but it's related to DBI, so I'm asking here also: I have a field in a record in the MySQL database that contains a number. I increase it by one with $dbh-do(update table set myfield = myfield + 1

Re: Randal L. Schwartz is Wrong (WAS:write out filenames of files existing on a filesystem into afile)

2006-07-13 Thread Dave Gray
On 7/13/06, Chad Perrin [EMAIL PROTECTED] wrote: On Thu, Jul 13, 2006 at 01:44:40AM -0400, Mr. Shawn H. Corey wrote: It comes down to this, either he will post an apology for stating a third party should not post his comments, or I'll leave this list, never to return. 1. You may have been

Re: Slurping a big file (WAS: Netiquette)

2006-06-24 Thread Dave Gray
On 6/23/06, Omega -1911 [EMAIL PROTECTED] wrote: On 6/23/06, Dave Gray [EMAIL PROTECTED] wrote: On 6/23/06, Omega -1911 [EMAIL PROTECTED] wrote: Shawn, I modified your example like so, was this correct? chomp( my $data1 = IN ); # line 1 chomp( my $data2 = IN ); # line 2 chomp( my

Slurping a big file (WAS: Netiquette)

2006-06-23 Thread Dave Gray
On 6/23/06, Omega -1911 [EMAIL PROTECTED] wrote: Shawn, I modified your example like so, was this correct? chomp( my $data1 = IN ); # line 1 chomp( my $data2 = IN ); # line 2 chomp( my $data3 = IN ); # line 3 chomp( my $data4 = IN ); # line 4 chomp( my $data5 = IN ); # line 5 while( IN ){

Re: An array like line that I do not understand

2006-06-16 Thread Dave Gray
On 6/16/06, Alan_C [EMAIL PROTECTED] wrote: [snip] 1 'build' slack build slackbuild sbuild pkg 2 'build' slack build slackbuild sbuild pkg 3 'build' slack build slackbuild sbuild pkg 4 'kernel' slackware 2.6 kernel howto 5 'kernel' kernel compile install 2.6 6 'build' building a linux

Re: Servlet

2006-06-05 Thread Dave Gray
On 5/30/06, Tom Allison [EMAIL PROTECTED] wrote: How can I impliment a Servlet in Perl without writing my own http server or running apache? What exactly are you trying to do? I assume you didn't get a response because you weren't very specific. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Counting arrays

2006-05-22 Thread Dave Gray
On 5/22/06, Michael Gargiullo [EMAIL PROTECTED] wrote: It's been a while since I've used Perl and I need some help with a multidimensional array. I have a file that I need to compile some stats on. I need to keep track of 'actions' and 'rules'. Yes, stats from a firewall. Both 'actions' and

Re: Python - NOT TROLLING

2006-04-25 Thread Dave Gray
On 4/25/06, Paul D. Kraus [EMAIL PROTECTED] wrote: I am picking up python and messing around with it and I always come running back to perl :) At any rate I am curious what the more experienced programmers think of the language and its uses. One thing that a lot of people like about Python is

Re: Very Basic Web Scrape

2006-04-07 Thread Dave Gray
On 4/7/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Fri, 07 Apr 2006 16:02:53 -0400, Oliver Block [EMAIL PROTECTED] wrote: I understand regex, but the following fails: open PAGE, 'c://redcross.htm'; while( my $line = PAGE ) { $line =~ /Health and Safety Classes/ print $1\n; }

Re: regex one liner

2006-03-21 Thread Dave Gray
On 3/21/06, Kevin Viel [EMAIL PROTECTED] wrote: BTW, out here in the real world (that would be UNIX), *.pl stands for Perl Library file, not a script. What extension do you suggest using, if any, in the real world? .ps for perl script /snicker -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: new for regular expression in Perl

2006-01-04 Thread Dave Gray
On 1/4/06, chen li [EMAIL PROTECTED] wrote: I think it might be natural for me to read the file line by line and get the return position looks like these(just an example), similar to do the word search in microsoft Word, which is what I really want: match in line 1 and the end of matching

Re: pack an array

2006-01-04 Thread Dave Gray
On 1/2/06, John W. Krahn [EMAIL PROTECTED] wrote: Gerard Robin wrote: Hello, Hello, I guess that one can write in more perlish fashion that I did: the part between the of this script to pack the array @array. Please, can someone give me some hint ? You don't need to use an

Re: having problems with index of a date string

2005-11-16 Thread Dave Gray
On 11/11/05, kathyjjja [EMAIL PROTECTED] wrote: I am trying to add the date to a file name. [snip] Usually when I want to do something like this, it's to make a uniquely named temp file, so the date doesn't need to be human readable, so something like this works just fine: #

Re: combining array ref's

2005-11-16 Thread Dave Gray
On 11/13/05, Tom Allison [EMAIL PROTECTED] wrote: my $A = [1,2,3,4,5,6,7,8,9]; my $B = [11,12,13,14,15,16,17,18,19]; timethese(1000, { 'plain' = 'my $array = [$A, $B];', 'loopy' = 'push @$A, $_ foreach @$B;' }); Another important

Re: Thank you for your answer. And yesterday i was write from Nahid`s email address

2005-10-17 Thread Dave Gray
On 10/17/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is a file is info.xml and it constraint below info Personal NAMEUlfet/NAME SURNAMETANRIVERDIYEV/SURNAME AGE24/AGE ADDRESSBAKU/ADDRESS /Personal Education SCHOOLXetai

Re: Alcatel CORBA 5620 OSS

2005-10-17 Thread Dave Gray
On 10/17/05, Tielman Koekemoer (TNE) [EMAIL PROTECTED] wrote: We have an Alcatel CORBA 5620 gateway from which we have extract information. Does anyone know of a module that would enable Perl to access this service? I searched the CPAN's archive but could not find anything. Apologies if this

Re: Finding directories within a tree

2005-10-07 Thread Dave Gray
On 10/7/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am receiving numerous amounts of mail but have not filled out any questionnaires giving away any sort of information. If these letters continue being sent to me I will be forced to report you to AOL as spam and possibly other forms to

Re: Finding directories within a tree

2005-10-07 Thread Dave Gray
On 10/7/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Good Afternoon I am attempting to develop a script that will parse a directory listing and return only directory names that match a given expression. It would make sense to me to use File::Find to do this but based on the dir

Re: WELCOME to beginners@perl.org

2005-09-28 Thread Dave Gray
On 9/28/05, Ryan Frantz [EMAIL PROTECTED] wrote: Just for giggles, I'm gonna assume that you're using PPM (you gave nothing else to go on)... I've only installed this particular module using ActiveState's 'ppm' myself; it seems to have problems with the '::' in module names. If ppm can't

Re: naming subroutine reference parameter?

2005-09-06 Thread Dave Gray
On 9/6/05, Jayvee Vibar [EMAIL PROTECTED] wrote: How do you name subroutine reference parameter in perl? Naming a local or pass by value is by simply using my ($param1, $param2) = @_ ; How about by reference? I think it would be harder if I'll be using $_[0], $_[1] direct method. Is it

Re: firing an external program and exiting

2005-08-03 Thread Dave Gray
On 8/2/05, Ram [EMAIL PROTECTED] wrote: I have a situation where a CGI script has to start an independent perl script and exit without capturing the output or waiting for the exit code. It doesnt make any practicle sense to me as this perl script takes good 6 hours to run and my CGI script

Re: Backup of a subroutine

2005-08-03 Thread Dave Gray
On 8/3/05, John W. Krahn [EMAIL PROTECTED] wrote: marcos rebelo wrote: I need to redefine localy one subroutine and have it correctlly after. How do I do it? $ perl -e' my $myPrint = sub { print Teste 1\n }; sub test { $myPrint = sub { print Teste 2\n } } $myPrint-(); test;

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I think I am on the right track as far as what assertion to use. I need to print from one string to another using .. with \G Why do you want to use \G? My goal is to capture from allsets down. Here is my code: #!/usr/bin/perl use

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: technically you are correct about escaping the dot, but in this particular situation my regexp is working. I will escape the dot. my goal again is to print from one sting to another from allsets down. I apologize for the long output

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: yes but the problem is my start point and end point have identical entries under them. It is stopping at original1.1 when I need for it to stop at the end of original1.1 and print media: sf Volumes: STK000 Total space available:

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, Dave Gray [EMAIL PROTECTED] wrote: On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: yes but the problem is my start point and end point have identical entries under them. It is stopping at original1.1 when I need for it to stop at the end of original1.1 and print media

Re: firing an external program and exiting

2005-08-02 Thread Dave Gray
On 8/2/05, Ram [EMAIL PROTECTED] wrote: I have a situation where a CGI script has to start an independent perl script and exit without capturing the output or waiting for the exit code. It doesnt make any practicle sense to me as this perl script takes good 6 hours to run and my CGI script

Re: firing an external program and exiting

2005-08-02 Thread Dave Gray
On 8/2/05, Ram [EMAIL PROTECTED] wrote: I tried exec(command); and also system(command ); Niether seemed to work, for the reason which I assume is, since it is a CGI script and webserver waits until this script exits and then displays the results to the browser. What

Re: Using Config files and variables.

2005-08-01 Thread Dave Gray
On 7/31/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: problem is that the variables in the config are not being translated into there actual values before they get used. So you have a plaintext config file with variable names in it that you want perl to interpolate at some point once the

Re: 'Use Lib' problem...

2005-08-01 Thread Dave Gray
On 7/26/05, Tony Frasketi [EMAIL PROTECTED] wrote: I'm trying to use the following 'use lib' statement as described at http://www.unix.org.ua/orelly/perl/prog3/ch31_13.htm It's not nice to link to pirated copies of books. BAD. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Atmoic operations in Multi-threaded Perl?

2005-07-07 Thread Dave Gray
On 7/6/05, Siegfried Heintze [EMAIL PROTECTED] wrote: Can I assume that an auto-increment operation on an integer value is atomic (that is, cannot be interrupted by another thread)? This is a common assumption in C/C++. The perl debugger I use leads me to believe that perl stores all integers

Re: usage of do {}

2005-06-30 Thread Dave Gray
On 6/30/05, Peter Rabbitson [EMAIL PROTECTED] wrote: Here and there on the web I encounter claims that the do {} operator is depreciated. However I find it convenient to do things like: eval { some stuff } or do { some multiline error handling }; is this a bad practice? No, that's not bad

Re: usage of do {}

2005-06-30 Thread Dave Gray
On 6/30/05, Jay Savage [EMAIL PROTECTED] wrote: Checking for $@, though, is a must no matter what you're using [eval] for. +1 despite my completely missing that omission earlier! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Run a subroutine, then replace subroutine and run again

2005-06-28 Thread Dave Gray
On 6/27/05, Wagner, David --- Senior Programmer Analyst --- WGO [EMAIL PROTECTED] wrote: Sorry, but I have two subroutines with the same name which is fine because I have not had a need to use the hashes which these two similar subroutines created. How do I run the

Re: deleting ldap users question

2005-06-27 Thread Dave Gray
On 6/27/05, Graeme McLaren [EMAIL PROTECTED] wrote: Hi all, I am trying to delete entries from an LDAP server and I don't understand why my code is not deleting the relevant entries. [snip] here is my code: # #!/usr/bin/perl use

Re: Logger output behavior not wanted

2005-06-27 Thread Dave Gray
On 6/27/05, Pablo Wolter [EMAIL PROTECTED] wrote: Hi, I have some troubles to figuring out by myself a way to add the output of a script that I run by system function in perl into a logger. The code I have is: [snip] print LOG -- $hostName Database backup\n; print LOG -- Database

Re: How to handle Null-Charakters

2005-06-22 Thread Dave Gray
On 6/22/05, Angerstein [EMAIL PROTECTED] wrote: I have a problem reading strings out of a binaery file. The last 128 Byte of the File contains a String I want to work with. (sorry, this code is windows, feel free to flame me ^^) my $tsize = 128; my

Re: creating html interface for the perl code

2005-06-22 Thread Dave Gray
On 6/22/05, Aditi Gupta [EMAIL PROTECTED] wrote: I've to create html inteface for a perl code. I've to get the input from the user and the data entered in the form has to be processed and output(which is a graph) has to be displayed to the user. But i don't know how to do it... I am adviced to

Re: how to append blocks in same file

2005-06-22 Thread Dave Gray
On 6/22/05, Aditi Gupta [EMAIL PROTECTED] wrote: Since i'm using activestate perl on windows xp i don't know whether paste will work or not. I'll try the hash of array. Using a hash of arrays will not necessarily preserve the order. Below is the start of an array of arrays solution. I'll leave

Re: Syncsave Integers 7Bit Data +1 sync bit... How do I get my value out of it?

2005-06-22 Thread Dave Gray
On 6/22/05, Angerstein [EMAIL PROTECTED] wrote: The mp3 format uses something (sick) called syncsave integer. If you have a 4 Byte 32 Bit the very first bit of every Byte is used as a syncsave bit. so you can only put a 28 Bit long Number in it. Puting stuff in this format is the one thing

Re: how to append blocks in same file

2005-06-22 Thread Dave Gray
On 6/22/05, Dan Klose [EMAIL PROTECTED] wrote: Using a hash of arrays will not necessarily preserve the order... If you don't want to worry about sorting the order of the blocks i.e. doing it yourself then use Tie::IXhash (something like that on CPAN) to preserve the order, you then don't

Re: hashes and loops

2005-06-15 Thread Dave Gray
On 6/14/05, Karyn Williams [EMAIL PROTECTED] wrote: Below is code that I found on the web that I slightly modified. I am trying to create a script to remove from a file (tlist) the items in another file (tnames). This works but I have multiple files (tlist) I need to check against. I'm not

Re: @array =to= $array

2005-06-10 Thread Dave Gray
my $localtime; @$localtime{qw / second minute hour mday month year weekday yearday isdst /} = localtime(time); [1] A style nit: Speaking of nitpicks: my %localtime; If you DO need to iterate across all the indices for an array ( rarely necessary if you have designed your data correctly )

Re: host id

2005-06-10 Thread Dave Gray
On 6/10/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I whole heartedly agree! top post rules! Apparently, so does Lotus Notes. My deepest sympathies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: host id

2005-06-10 Thread Dave Gray
On 6/9/05, Wiggins d'Anconia [EMAIL PROTECTED] wrote: 4. Speed/Forking: because backticks causes a fork, you are using system resources in a way you wouldn't necessarily need to if you were able to use a built-in function. When Perl forks, it forks an exact copy of the running process and then

Re: @array =to= $array

2005-06-10 Thread Dave Gray
On 6/10/05, Lawrence Statton [EMAIL PROTECTED] wrote: my $localtime; @$localtime{qw / second minute hour mday month year weekday yearday isdst / } = localtime(time); [1] A style nit: Speaking of nitpicks: my %localtime; Assuming you are suggesting making that change,

Re: @array =to= $array

2005-06-10 Thread Dave Gray
On 6/10/05, Lawrence Statton [EMAIL PROTECTED] wrote: Huh. So it does... that doesn't look like it's making a reference, though. I think I would write that as @{$localtime}{ ... } for clarity. As to the clarity question. To my eyes, I find spurious {} tend to diminish rather than

Re: Favorite packages for benchmarking?

2005-06-03 Thread Dave Gray
On 6/2/05, John W. Krahn [EMAIL PROTECTED] wrote: Siegfried Heintze wrote: There are lots of packages for date-time computations. What is the best one for timing computations for benchmarks? I'm thinking I want to fetch the time in 64 bit format instead of year, mo, day, hour, min, sec,

Re: Re: file parsers (fwd)

2005-06-03 Thread Dave Gray
On 6/3/05, Chris Devers [EMAIL PROTECTED] wrote: This was really annoying. Please, please, please: do not sign up for a mailing list using one of these challenge/response email systems. It's a waste of everyone's time. +1 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: Can't use subscript in angle brackets

2005-05-25 Thread Dave Gray
foreach my $file ( @ARGV ){ if( my $fh = new IO::File $file ){ # Be explicit[1] if (my $fh = IO::File-new($file)) { push @infh, $fh; } else { die Failed to open input file '$file': $!; } } [1] http://www.perl.com/doc/manual/html/pod/perlobj.html#WARNING -- To unsubscribe,

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Dave Gray
On 5/23/05, Peter Rabbitson [EMAIL PROTECTED] wrote: On Mon, May 23, 2005 at 01:40:08PM -0400, Zhenhai Duan wrote: I tried hash (where the members of a group are joined with :), and hash of hash. It happended that hash of hash is slower than single hash. Hash: $groups{$g1} =

Re: efficiency of hash of hashes/lists

2005-05-24 Thread Dave Gray
# access test for 2d ($su, $ss) = times; for my $i (0 .. $hashsize-1) { $oned{$l1[$i]}{$l2[$i]}++ I think you should be operating on %twod here. LOL, thanks. Original poster take note: generating hashes..! base 0.03 0.00 0.03 1D 0.24

Re: A very general question to perl experts

2005-05-17 Thread Dave Gray
sub readDefectData { my $defectDataFH=new FileHandle; open ($defectDataFH,$_[0]) or die Error: Cannot load defectivity data, $_[0]\n; print Loading defect data ... ; my %short; while ($_=$defectDataFH-getline) { chomp;

Re: Determine structure size

2005-05-17 Thread Dave Gray
Is there a way to determine how much a certain data structure costs in terms of memory? In other words is there some built in command or module that takes a reference to a nested data structure and gives a ball park idea of how much memory this structure takes.

Re: Threads related document to refer in perl

2005-05-16 Thread Dave Gray
I want to create threads using perl. So if any documents or links are there to refer please send me. Here's some pretty basic threading code: http://coding.derkeiler.com/Archive/Perl/perl.beginners/2004-10/0504.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: Attempt to free unreferenced scalar

2005-05-16 Thread Dave Gray
After running a program, I saw the following errors: Attempt to free unreferenced scalar: SV 0x38bd0a4, Perl interpreter: 0x162445c at E:/usr/lib/Errno.pm line 15 (#1) Attempt to free unreferenced scalar: SV 0x38bd0a4, Perl interpreter: 0x162445c at E:/usr/lib/Errno.pm line 15. The only

Re: looping over a tied hash problem

2005-05-11 Thread Dave Gray
Dave, I've got some more code here that should explain exactly what I'm trying to do, what do you think of the structure? As you can probably tell I'm having problems accessing the keys and values from a tied hash, any ideas how I can get the keys and the values printed to the screen?

Re: looping over a tied hash problem

2005-05-10 Thread Dave Gray
I'm kind of lost as to what you're actually trying to do. Instead of posting functions with nothing calling them, you should include a code snippet (as simple as possible) that can be run to demonstrate the problem. Preferably not using those functions. Fix one thing at a time. With that said,

Re: one-liner multi-line regex problem

2005-04-25 Thread Dave Gray
I'm trying to write a perl one-liner that will edit an iCalendar format file to remove To Do items. The file contains several thousand lines, and I need to remove several multi-line blocks. The blocks to remove start with a line BEGIN:VTODO (without the quotes) and end with a line END:VTODO

Re: nested replace string

2005-04-11 Thread Dave Gray
Please help me in where I am going wrong and suggest me the solution. Since you have the data in nice XML format, why not use an XML parser instead of parsing it yourself? http://perl-xml.sourceforge.net/faq/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Redirect on the pushing button

2005-03-31 Thread Dave Gray
I am create edit data form, and it ask visitor: do you wish edit data? All is ok with Yes button, but I don't kniw what with No button :-) I wish that clicking NO button recirect me on some URL.. You can do this in perl by sending a Location header back to the browser before you send

Re: Redirect on the pushing button

2005-03-31 Thread Dave Gray
You can do this in perl by sending a Location header back to the browser before you send Content-type a la: #!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Carp 'fatalsToBrowser'; my $cgi = new CGI; my $form = $cgi-Vars; if ($form-{no}) { print

Re: I think I need another regex...

2005-03-17 Thread Dave Gray
I tried to do this with split(), but it's not working good at all The string: interface=something very long with spaces and all mac-address=00:02:6F:36:2D:31 ap=no wds=no rx-rate=11Mbps tx-rate=11Mbps packets=12623,18377 bytes=10829240,2009327 frames=12623,18377 (the above is one line,

Re: I think I need another regex...

2005-03-17 Thread Dave Gray
On Thu, 17 Mar 2005 11:32:23 -0500, Dave Gray [EMAIL PROTECTED] wrote: I tried to do this with split(), but it's not working good at all The string: interface=something very long with spaces and all mac-address=00:02:6F:36:2D:31 ap=no wds=no rx-rate=11Mbps tx-rate=11Mbps packets

Re: [PBML] Query about perl modules

2005-03-16 Thread Dave Gray
blade:~/personal/perl cat -n check.p 1 #!/usr/bin/perl 2 3 use Net::Telnet; 4 5 $timeout = 10; 6 $obj=new Net::Telnet( [Timeout = $timeout,] ); 7 blade:~/personal/perl perl check.p unknown remote host: ARRAY(0x22494) at check.p line 6

Re: z/OS unicode error.

2005-03-15 Thread Dave Gray
Are you running with strict and warnings turned on? Because I'm getting Malformed UTF-8 character messages running this: #!/usr/bin/perl use strict; use warnings; my $u = unpackU0U, \x8a\x73; print \$u: $u\n; my $p = pack(U0U, $u); print \$p: $p\n; And I can get rid

Re: pack-unicode problem (z/OS)

2005-03-11 Thread Dave Gray
I am running perl 5.8.6 on z/OS unix. I am doing these : $u = unpackU0U, \x8a\x73; print \n\$u : $u; $p = pack(U0U, $u); print \n\$p : $p; Are you running with strict and warnings turned on? Because I'm getting Malformed UTF-8 character messages running this: #!/usr/bin/perl use

Re: Regex Multi line match

2005-03-08 Thread Dave Gray
This is the multi line pattern in which I wish to match: tr tdb String 1.2.3.4.5.6 /b/td tdimg src=pics/green.gif alt=OK/td tr One way to solve this would be to read lines from the file and save chunks of N lines (4 in this case) in a temp variable. Then your regex would operate on enough

Re: Regex Multi line match

2005-03-08 Thread Dave Gray
Something like (untested): my (@lines, $num) = ((), 4); while (INPUT) { push @lines, $_; shift @lines if @lines == $num+1; print 'lines '.($.-$num+1).' to '.($.). match\n if join('',@lines) =~ /regex goes here/; } That assumes that the pattern being searched for

Re: Regex Multi line match

2005-03-08 Thread Dave Gray
my (@lines, $num) = ((), 4); You are assigning the list ((), 4) to @lines and nothing to $num. Perhaps you meant: my ( $num, @lines ) = ( 4, () ); Or simply: my ( $num, @lines ) = 4; Indeed, good catch. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: Compile perl code/files via STDIN

2005-02-02 Thread Dave Gray
yes that is exactly what i mean. i want to do somthing like this: $ perl - c print Test\n; and now i want to get the infos of the compilation (sytax ok or errors...). after that i want to put the next perl code into the process, i don't want to close the process

Re: Compile perl code/files via STDIN

2005-02-01 Thread Dave Gray
i want to open a perl process and enter the code/files to compile via STDIN. i know it is possible. but how? does somebody know a tutorial or something like this which explains how i can compile perl code via STDIN? $ perl print Hello from STDIN\n; ^D Hello from STDIN $ If the answers so

Re: How to find regex at specific location on line

2005-01-24 Thread Dave Gray
'plain_regex'= sub { if ( $string =~ /^.{38}\|[BNPG]\|/ ) { my $a = $_ } }, 'plain_regex'= sub { if ( $string =~ /^.{38}\|N\|/ ) { my $a = $_ } }, What was interesting to me was that although, predictably, the substring/regex combo was consistently the best performer for

Re: PERL with grep

2005-01-21 Thread Dave Gray
I would like the script to do the following: 1) List all *.java files containing following patterns: double, parseDouble Sounds to me like you don't need to resort to perl yet with this problem... egrep -rHis '\bdouble\b|\bparsedouble\b' /path/to/dir/ -- To unsubscribe, e-mail: [EMAIL

Re: Dynamic pattern matching?

2005-01-18 Thread Dave Gray
I know I can write an if() clause to match every possible case, but I'm wondering if there is a more general approach that would allow me to dynamically match a varying number of extra columns within a single expression. You could shove all the data points into one parenthetical group in the

Re: Regex help

2005-01-17 Thread Dave Gray
On Mon, 17 Jan 2005 08:37:07 +0100, manfred [EMAIL PROTECTED] wrote: That leads me to a question :-) if ($num =~ /^(\d+)\#([^\#]*?)\#(?:e\+(\d+))?$/x) { What particular use has the _x_ modifier in this example? I mean the hashes are escaped? I forgot to remove the /x when I stripped

Re: Substitute Varaible

2005-01-17 Thread Dave Gray
On Mon, 17 Jan 2005 16:11:54 +0530, Anish Kumar K. [EMAIL PROTECTED] wrote: Hi I need help regarding substituion of varaibles with values Say I have a txt file (a.txt) which has only one line: Hi $name The PL file use strict; use warnings; open INPUT, a.txt; Always

Re: regular expression question

2005-01-17 Thread Dave Gray
I am new to perl, I receive some spam email with subject like st0ck, 0pportunities, gr0wth..., how can I match those words with number 0 in Something like __CODE__ use warnings; use strict; use Data::Dumper; # add to this hash to make it slower my %rep = ( 'a' = [4], 'e' = [3], 'i' =

Re: Regex help

2005-01-16 Thread Dave Gray
On Sat, 15 Jan 2005 01:25:21 -0800 (PST), Ajey Kulkarni [EMAIL PROTECTED] wrote: I'm trying to match a floating point in ada. They are normal floating points with 2 extra things.(they can or can't come) 1. an underscore is permitted between the digits and 2. An alternate numeric base may

Re: Regex lookahead problem

2005-01-14 Thread Dave Gray
On Fri, 14 Jan 2005 07:11:30 +, Andrew Black [EMAIL PROTECTED] wrote: Can someone explain how lookaheads work and give an example of using one Cheers I find the full names of these regex constructs to be quite enlightening: zero-width (positive|negative) look-(ahead|behind) assertion. So

Re: Memory full

2005-01-12 Thread Dave Gray
Here is an example of a program and a perl module that parses a .xls file and eats the whole memory. I have tried it under Linux and Windows and it has the same problem under both OSs, so it has big bugs. [snip] #Insert into database my $rapoarte_i = $dbh-prepare(insert ignore into

Re: Is GOTO evil?

2005-01-06 Thread Dave Gray
On 6 Jan 2005 16:11:40 -, Peter Scott [EMAIL PROTECTED] wrote: The only times I've used goto in Perl have been the goto sub form, which isn't much of a goto in the first place :-) I use it the most when I'm debugging. For example, if I'm hacking on a webpage with a bunch of redirects, I'll

Re: Copying a hash-of-hashes

2004-12-30 Thread Dave Gray
The question is whether there is an elegant way to produce a complete copy of a hash-of-hashes-of-hashes-...-of-hashes for internal subroutine purposes and make sure that all references will be translated properly as well, leaving the subroutine no ability to modify the main hash. You might

Re: Can someone translate a small .PY to Perl?

2004-12-29 Thread Dave Gray
On Wed, 29 Dec 2004 12:50:21 -0500, GMane Python [EMAIL PROTECTED] wrote: while ( ) { That isn't doing what you expect, which (I assume) is an infinite loop. loops over @ARGV and attempts to open each arg as a file and iterate over the lines in each. I suppose it is functionally a somewhat

Re: Can someone translate a small .PY to Perl?

2004-12-28 Thread Dave Gray
was wondering if there were a translation in PERL so I could have my Netware servers send heartbeats to the heartbeat server? Title: PyHeartbeat - detecting inactive computers Submitter: Nicola Larosa # Filename: HeartbeatClient.py Heartbeat client, sends out an

Re: basic search engine

2004-12-15 Thread Dave Gray
I am planning to write a simple search engine. The engine would be able to search for a word or phrases from a file and probably point the user the line number the word is found. The issue is I want the engine to be able to support more advance search techniques which means it could support

Re: control loop question

2004-12-14 Thread Dave Gray
Let's say I have a text file filled with: stuff stuff stuff Users sometext tom dick harry Users more sometext larry curly moe moe stuff

Re: regexp for a blank line

2004-12-14 Thread Dave Gray
Christopher Spears [mailto:[EMAIL PROTECTED] wrote: I have to write a script that processes text in a file. The text includes lots of blank lines. How can I tell Perl to skip the lines? On Tue, 14 Dec 2004 11:22:54 +0530, Mallik [EMAIL PROTECTED] wrote: next if ($line =~ /^\s*$/); +1 -

Re: Should be a simple substitution?

2004-12-08 Thread Dave Gray
I think the ?: must be extraneous: That construct lets the regex engine know that it doesn't need to worry about saving backreferences to the parenthesized group. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

  1   2   >