Re: Regex problems

2004-08-23 Thread Randy W. Sims
me wrote: Hello all, I have been beating my head against the wall for a while trying to extract some data. Here is the following data: My goal is to put all data after each colon into a variable. I don't have any problem with Data 1 through Data 4. My problem is when I get to Data 5:, I can't fig

RE: Regex problems

2004-08-23 Thread Charles K. Clarkson
From: me wrote: : Hello all, : : I have been beating my head against the wall for a : while trying to extract some data. : : Here is the following data: : : : === : Data 1: data1 : Data 2: data2 : Data 3: data3 : Data 4: data4 : Data 5: : data5 data5

RE: Need help to sort data

2004-08-23 Thread Tim Johnson
For starters, ALWAYS 'use strict;' and 'use warnings;' at the beginning of your scripts. It's a little annoying at first, but it saves you from some very time-consuming mistakes down the line. Okay, here is one way to do the kind of thing I think you are asking to do. Keep in mind that I took s

Regex problems

2004-08-23 Thread me
Hello all, I have been beating my head against the wall for a while trying to extract some data. Here is the following data: === Data 1: data1 Data 2: data2 Data 3: data3 Data 4: data4 Data 5: data5 data5 data5 data5 data5 data5 data5 data5 data5 data5 data5 data5 ==

Need help to sort data

2004-08-23 Thread Robin Smith
Hi, I have a flat file data in the form of user and groups. The user always come first follow by the groups. Now I need to arrange then by groups. This is the code I have been working with. the groups are listing but the users are not. I am still fairly new to perl so I need someone with s

Re: searching a whole array without using a loop

2004-08-23 Thread John W. Krahn
Darren Birkett wrote: Hi, Hello, Is there a better way to search all elements of an array for a string (without using a loop to test individual elements) than: $line = join(' ',@myarray); if ($line =~ /my string/) { some code } I've seen map and grep used by some but also critisized by so

Re: Trying to parse XML file

2004-08-23 Thread Richard Jolly
On 23 Aug 2004, at 20:29, Kevin Old wrote: Hello everyone, I'm new to parsing XML files. I've got a somewhat working attempt, but keep getting errors when certain elements are undefined. Can't call method "as_text" on an undefined value at ./xmltreebuild.pl line 33. Believe the error message! Lin

RE: Trying to parse XML file

2004-08-23 Thread Thomas, Mark - BLS CTR
> Could I use the "findnodes" subroutine you're using > above as a regular expression? The expressions in XML::LibXML and XML::XPath are XPath expressions. They are very powerful in that you can generally craft an XPath expression to get exactly what you want, making most extractions a one-liner.

Re: searching a whole array without using a loop

2004-08-23 Thread Chris Devers
On Mon, 23 Aug 2004, Darren Birkett wrote: Is there a better way to search all elements of an array for a string (without using a loop to test individual elements) than: $line = join(' ',@myarray); if ($line =~ /my string/) { some code } I've seen map and grep used by some but

RE: Trying to parse XML file

2004-08-23 Thread Thomas, Mark - BLS CTR
Your code loops around a 'product-announced' element, which doesn't exist in your file. Does that have something to do with it? Since you say you're new to XML parsing, perhaps you'd like to see an example of an alternate solution. The following is XML::LibXML code, and XML::Xpath code would be vi

searching a whole array without using a loop

2004-08-23 Thread Darren Birkett
Hi, Is there a better way to search all elements of an array for a string (without using a loop to test individual elements) than: $line = join(' ',@myarray); if ($line =~ /my string/) { some code } I've seen map and grep used by some but also critisized by some. I thought there might

Re: Mime::Lite - Windows Question

2004-08-23 Thread Jenda Krynicky
From: "Paul Kraus" <[EMAIL PROTECTED]> > I am sending a mail with an excel sheet attached (created with > spreadsheet::writeexcel. > > I am using Mime::Lite to send the mail. > > Is their a way to have the file as the body of the message? > > If I open Excel and mail the worksh

Re: Trying to parse XML file

2004-08-23 Thread Kevin Old
On Mon, 23 Aug 2004 17:02:20 -0400, Thomas, Mark - BLS CTR <[EMAIL PROTECTED]> wrote: > Your code loops around a 'product-announced' element, which doesn't exist in > your file. Does that have something to do with it? > > Since you say you're new to XML parsing, perhaps you'd like to see an > exam

Re: Sed-type-function

2004-08-23 Thread James Edward Gray II
On Aug 23, 2004, at 2:31 PM, Dave Kettmann wrote: Ok ... I'm going to try to confuse everyone again because either a) I'm dense or b) I'm asking the wrong question. Everyone can agree with option a, and I will not get mad :). Ok .. here goes again... For future reference, we prefer you submit you

RE: Sed-type-function

2004-08-23 Thread Chris Devers
Please consider bottom-posting to lists, and trimming old parts of the reply. Anyone that doesn't have the earlier material can look in the archives. Thanks :-) On Mon, 23 Aug 2004, Dave Kettmann wrote: I want this ...: Aug 23 14:28:32 Auth.notice: (Access-Request 10.10.116.4 166 "000611-011c0c"

Re: Sed-type-function

2004-08-23 Thread John W. Krahn
Dave Kettmann wrote: Ok ... I'm going to try to confuse everyone again because either a) I'm dense or b) I'm asking the wrong question. Everyone can agree with option a, and I will not get mad :). Ok .. here goes again... I looked at s2p and it spit out 2 pages of perl code of which the sed comma

Re: Sed-type-function

2004-08-23 Thread David Greenberg
$str =~ s/Auth.notice: //; $str =~ s/\[[\]]*\]//; print $str; I'm not sure if there's a way to put it all in one line, but this should do it nonetheless. -David On Mon, 23 Aug 2004 14:31:01 -0500, Dave Kettmann <[EMAIL PROTECTED]> wrote: > Ok ... I'm going to try to confuse everyone again becau

RE: Sed-type-function

2004-08-23 Thread Dave Kettmann
Ok ... I'm going to try to confuse everyone again because either a) I'm dense or b) I'm asking the wrong question. Everyone can agree with option a, and I will not get mad :). Ok .. here goes again... I looked at s2p and it spit out 2 pages of perl code of which the sed command was a small bit

Trying to parse XML file

2004-08-23 Thread Kevin Old
Hello everyone, I'm new to parsing XML files. I've got a somewhat working attempt, but keep getting errors when certain elements are undefined. Can't call method "as_text" on an undefined value at ./xmltreebuild.pl line 33. Attached is the XML I'm trying to parse and xmltreebuild.pl. Any sugge

RE: Sed-type-function

2004-08-23 Thread jeffrey_n_Dyke
> Hmm .. wonder why I didnt see that in any of the books i looked at. Ok off I go then, Thanks for the help! Sorry to > confuse you guys :) > Dave start here - perldoc perlop (or http://www.perldoc.com/perl5.8.4/pod/perlop.html#Regexp-Quote-Like-Operators) and perldoc perlretut ( or http://www

RE: Sed-type-function

2004-08-23 Thread Dave Kettmann
Hmm .. wonder why I didnt see that in any of the books i looked at. Ok off I go then, Thanks for the help! Sorry to confuse you guys :) Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 10:59 AM To: Dave Kettmann Cc: Perl List (E-mail

RE: Sed-type-function

2004-08-23 Thread jeffrey_n_Dyke
> I guess and easy syntax for search and replace similar to: > s/this/that/g ... Perl has that, you can use exactly the same syntax -- s/search/replace/g hth Jeff > Guess I will look at the s2p you mentioned as well. > Dave -Original Message- From: Randy W. Sims [mailto:[EMAIL PROT

perl.beginners Weekly list FAQ posting

2004-08-23 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address):

Re: Sed-type-function

2004-08-23 Thread James Edward Gray II
On Aug 23, 2004, at 10:50 AM, Dave Kettmann wrote: I guess and easy syntax for search and replace similar to: s/this/that/g ... Perl supports this exact syntax, so you are confusing a lot of us now... :D James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

RE: Sed-type-function

2004-08-23 Thread Dave Kettmann
I guess and easy syntax for search and replace similar to: s/this/that/g ... Guess I will look at the s2p you mentioned as well. Dave -Original Message- From: Randy W. Sims [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 10:39 AM To: Dave Kettmann Cc: Perl List (E-mail) Subject:

Re: Sed-type-function

2004-08-23 Thread Randy W. Sims
Dave Kettmann wrote: List, Does perl have any built-in sed-like function? I found ASED.pm, but would rather go with something built in. I looked around a bit, but didnt find anything. I guess I could go with using the Shell module but would rather using as few modules as possible. I'm not sure what

Sed-type-function

2004-08-23 Thread Dave Kettmann
List, Does perl have any built-in sed-like function? I found ASED.pm, but would rather go with something built in. I looked around a bit, but didnt find anything. I guess I could go with using the Shell module but would rather using as few modules as possible. Thanks, Dave Kettmann NetLogic 63

Re: Mime::Lite - Windows Question

2004-08-23 Thread Chris Devers
On Mon, 23 Aug 2004, Paul Kraus wrote: Is [there] a way to have the file as the body of the message? Not that I can think of. It would be interesting to look at one of these Excel-embedded mails to see how it works. My hunch is that the message is being sent as a traditional multipart-mime messag

RE: Recording Ping responses in perl

2004-08-23 Thread Bob Showalter
Ben Crane wrote: > Hi all, > > I need to set the ping command running for a few hours > on my machine, and record (the exact time/date) then > the ping function fails. > > I have tried putting a script together but no joy. > Does anyone have a script like this that I could > please "borrow"?? I n

Mime::Lite - Windows Question

2004-08-23 Thread Paul Kraus
My usual environment is Linux so maybe some of you m$ guys can help me out. I am sending a mail with an excel sheet attached (created with spreadsheet::writeexcel. I am using Mime::Lite to send the mail. Is their a way to have the file as the body of the message? If I open Excel and ma

Re: Recording Ping responses in perl

2004-08-23 Thread Prasanna Kothari
hi, Have a look at the module Net::Ping for more options. here's a sample script that pings a host once and prints the result. #!/usr/bin/perl -w use strict; use English; use Net::Ping; my $host = ""; my $p = Net::Ping->new("icmp"); my $val = $p->ping($host); if(!($val)) { my @arr = localtime()

Recording Ping responses in perl

2004-08-23 Thread Ben Crane
Hi all, I need to set the ping command running for a few hours on my machine, and record (the exact time/date) then the ping function fails. I have tried putting a script together but no joy. Does anyone have a script like this that I could please "borrow"?? I need to run the checks this afterno

Re: replace string ?

2004-08-23 Thread Gunnar Hjalmarsson
Shu Hung wrote: > Is there any function for us to replace a specific string with > another? perldoc -f substr -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

replace string ?

2004-08-23 Thread Shu Hung (Koala)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there any function for us to replace a specific string with another? -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBKaAn4uyclScWNtARAgUEAJ44Hkf9M+5FuhCWHrtL9

Re: Assigning fix elements of array into fix variables efficiently

2004-08-23 Thread Edward Wijaya
Thanks so much. On Mon, 23 Aug 2004 03:17:40 -0400, Jeremy Kister <[EMAIL PROTECTED]> wrote: On Monday, August 23, 2004 3:12 AM, Edward Wijaya wrote: @array = (10,11,12) #fix to three element is there any way I can assign each any of these elements into variable ($A, $B, $C) in a quick way. Such

Re: Assigning fix elements of array into fix variables efficiently

2004-08-23 Thread Chandu B S
did U try this: ($a,$b,$c) = @array; - Original Message - From: "Edward Wijaya" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, August 23, 2004 12:42 PM Subject: Assigning fix elements of array into fix variables efficiently > > Hi, > > Suppose I have this array: > > @arra

Re: Assigning fix elements of array into fix variables efficiently

2004-08-23 Thread Jeremy Kister
On Monday, August 23, 2004 3:12 AM, Edward Wijaya wrote: > @array = (10,11,12) #fix to three element > > is there any way I can assign each any of these > elements into variable ($A, $B, $C) in a quick way. > Such that $A = 10, $B =11, $C=12 (this is fixed). ($a,$b,$c) = @array; Jeremy Kister ht

Assigning fix elements of array into fix variables efficiently

2004-08-23 Thread Edward Wijaya
Hi, Suppose I have this array: @array = (10,11,12) #fix to three element is there any way I can assign each any of these elements into variable ($A, $B, $C) in a quick way. Such that $A = 10, $B =11, $C=12 (this is fixed). The way I can think of is : $A = @array[1], etc.But this isn efficient.