Re: Perl Net::Pcap loop hang ??

2005-08-17 Thread John W. Krahn
Michael Gale wrote: > Hello, Hello, > I have tracked down a problem in my perl script to the module > Net::Pcap I believe and the loop mod. > > So using perl -MPCAN -e shell I tried to install Net:Pcap to see what > happens. > > After the make, it runs a check and produces the following out

date

2005-08-17 Thread Brent Clark
Hi all I have a date as the example format 01.01.06 (I know, but thats how I got it) anyway I need to check that this date is greater than current days date. Would anyone have any solutions to this problem. I have looked at the cpan repository, but from what I see they all work / deal with s

Re: date

2005-08-17 Thread Brent Clark
Brent Clark wrote: Hi all I have a date as the example format 01.01.06 (I know, but thats how I got it) anyway I need to check that this date is greater than current days date. Would anyone have any solutions to this problem. I have looked at the cpan repository, but from what I see they all

matching pattern & printing

2005-08-17 Thread Vineet Pande
Hi: In the following perl script, I would like to print all the lines in a file (mdout_short.txt) to temp.txt which have "NSTEP" as a word: use strict; use warnings; my $mdout_file = "mdout_short.txt"; my $mdout_xtemp_file = "temp.txt"; open

Re: matching pattern & printing

2005-08-17 Thread John Doe
Vineet Pande am Mittwoch, 17. August 2005 12.53: > Hi: > > In the following perl script, I would like to print all the lines in a file > (mdout_short.txt) to temp.txt which have "NSTEP" as a word: > > > use strict; > use warnings; > > my $mdout_file

Re: matching pattern & printing

2005-08-17 Thread John W. Krahn
Vineet Pande wrote: > Hi: Hello, > In the following perl script, I would like to print all the lines in a > file (mdout_short.txt) to temp.txt which have "NSTEP" as a word: > > > use strict; > use warnings; > > my $mdout_file = "mdout_short.txt";

RE: matching pattern & printing

2005-08-17 Thread Bedanta Bordoloi, Gurgaon
Hello, You can simply say while (){ if ($_ =~ /NSTEP/){ print OUT $_; } } Bedanta -Original Message- From: Vineet Pande [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 17, 2005 4:24 PM To: beginners@perl.org Subject: matching pattern & printing Hi:

Shuffling an file

2005-08-17 Thread dave.w.turner
Hello, I am working on a playlist managment program in perl - I need a way to shuffle the playlist - the playlist format is very simple - one filename on each line. Each file name is a reletive path, i.e: folder1/file1.mp3 folder2/file2.mp3 If possible I would like the file to be shuffled so th

Re: matching pattern & printing

2005-08-17 Thread Manav Mathur
> Hi: > > In the following perl script, I would like to print all the lines in a file > (mdout_short.txt) to temp.txt which have "NSTEP" as a word: > > > use strict; > use warnings; > > my $mdout_file = "mdout_short.txt"; > > my $mdout_xtemp_file =

Re: A sript to delete programs installed from source

2005-08-17 Thread dave.w.turner
Well, I think it's not fair to say that a package manager is a solution to the actual problem - he says: "How do i remove a program installed from source" - i.e. ALREADY installed. My only answers to this are "make uninstall" (in the origional source directory) or the program "make_uninstall". O

Re: Shuffling an file

2005-08-17 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > Hello, Hello, > I am working on a playlist managment program in perl - I need a way to > shuffle the playlist - the playlist format is very simple - one > filename on each line. > > Each file name is a reletive path, i.e: > > folder1/file1.mp3 > folder2/file2.mp3 > >

require and true value

2005-08-17 Thread gui
hi, I've looked in the archive but somehow my pb isn't solved. I've started to create a file that will containes a bunch of subroutines (file called "tools.pl"), which I intend to use later in my upcoming programs. I wanted to try out the require function, so I just put one subroutine in the tool

Re: Shuffling an file

2005-08-17 Thread mgoland
- Original Message - From: [EMAIL PROTECTED] Date: Wednesday, August 17, 2005 7:27 am Subject: Shuffling an file > Hello, Hi, > > I am working on a playlist managment program in perl - I need a > way to > shuffle the playlist - the playlist format is very simple - one > filename on eac

Re: require and true value

2005-08-17 Thread John Doe
gui am Mittwoch, 17. August 2005 14.53: > hi, [...] > pb arrives when I'm using require, I keep getting a "tools.pl did not > return a true value" message. In the archives I noticed that everybody > is saying that "you must not forget to add à '1;' at the end of your file". correct. > I did that,

Re: "$#{$array} "

2005-08-17 Thread JupiterHost.Net
Hi, Hello, I don't not understand how the $#{$array_r} returns "highest" element as 4 and not 5??? Because array elements are indexed starting at 0 not 1 and $#array returns the element nuumber not its value. See example below: #!/usr/bin/perl use warnings; use strict; my @array = (1,2,3

Quote Problem during Substitution

2005-08-17 Thread Todd
Hi, I am having a problem. I have a string ($newval) that has quotes (") in it: $newval="hba0-SCSI-target-id-7-name=\"0011884455667733\""; I can print $newval and I see this: print "Variable newval = $newval; Variable newval = "hba0-SCSI-target-id-7-name="0011884455667733" I am u

converting to FLOATING_POINT..

2005-08-17 Thread Vineet Pande
Hi: In the following piece of script, I would like to convert the $time after * by 2.0 to floating point, for instance i want 0*2 to be printed as 0.0; How to do that? if ($_ =~ ( /TEMP/ )) { my $time = (substr($_, 30, 14));

Re: converting to FLOATING_POINT..

2005-08-17 Thread Rex Rex
Replace, $time = ($time * 2.0); to $time = sprintf("%0.2f", ($time * 2)); That should do it. perldoc -f sprintf -- Rex On 8/17/05, Vineet Pande <[EMAIL PROTECTED]> wrote: > Hi: > > In the following piece of script, I would like to convert the $time after * > by 2.0 to floating point, for i

Re: Quote Problem during Substitution

2005-08-17 Thread John Doe
Todd am Mittwoch, 17. August 2005 16.16: > Hi, > > I am having a problem. I have a string ($newval) that has quotes (") in it: > $newval="hba0-SCSI-target-id-7-name=\"0011884455667733\""; This shouldn't be a problem. But there is no reason to use interpolating quotes: $newval='hba0-SCSI-targ

Re: converting to FLOATING_POINT..

2005-08-17 Thread Vineet Pande
Thanks Rex: Please help me in knowing one more related thing. I have from this script of mine an output like this: 0.00.00 0.460.37 0.8106.29 1.2140.56 1.6168.75 2.0186.37 2.4207.82 2.8225.45 3.2235.88 3.6245.55 4.0250.61 4.4260.06 4.8264.60 5.

Re: converting to FLOATING_POINT..

2005-08-17 Thread Rex Rex
If you are implying right alignment, then just put a minus sign before the formatting instruction. $time = sprintf("%-0.2f", ($time * 2)); -- Rex On 8/17/05, Vineet Pande <[EMAIL PROTECTED]> wrote: > I mean: > > 0.0 0.00 > 0.4 60.37 > 0.8106.29 > 1.2140.56 > 1.6168.75 > 2.0

Re: parsing columns

2005-08-17 Thread Robert Citek
On Aug 13, 2005, at 8:22 AM, Offer Kaye wrote: I have a text file with columns, where the columns may not be aligned, and not all lines may have data in all columns: header1 header2 header3header4 l1dat1l1dat2

substring

2005-08-17 Thread marcos rebelo
If I'm not wrong, Changing this lines: my @col = grep(!/\t/, split(/(\t)/, $line)); push(@col, "") if $line =~ /\t$/; by $line .= "\t"; my @col; my $lastIndex = 0; foreach my $actualIndex (0..length

Re: substring

2005-08-17 Thread Jeff 'japhy' Pinyan
On Aug 17, marcos rebelo said: my @col = grep(!/\t/, split(/(\t)/, $line)); push(@col, "") if $line =~ /\t$/; Wow. That could have just been my @col = split /\t/, $line; push @col, "" if $line =~ /\t$/; which should REALLY have been written as my @col = split /\t/, $line, -1; The

Re: substring

2005-08-17 Thread Paul Johnson
On Wed, Aug 17, 2005 at 06:26:16PM +0100, marcos rebelo wrote: > If I'm not wrong, Changing this lines: > > my @col = grep(!/\t/, split(/(\t)/, $line)); > push(@col, "") if $line =~ /\t$/; > > > by > > > $line .= "\t"; > my @col;

Re: substring

2005-08-17 Thread marcos rebelo
On 8/17/05, Paul Johnson <[EMAIL PROTECTED]> wrote: > On Wed, Aug 17, 2005 at 06:26:16PM +0100, marcos rebelo wrote: > > > If I'm not wrong, Changing this lines: > > > > my @col = grep(!/\t/, split(/(\t)/, $line)); > > push(@col, "") if $line =~ /\t$/; > > > > > > b

Re: require and true value

2005-08-17 Thread gui
I've been manipulating an old file while the main program was loading different one... so no matter how hard I try, the program still load a bad file I hate it when I do stupid things like that sorry for wasting your time over a stupid error, and thanks again for helping me! John Doe wrote: > gu

Re: Quote Problem during Substitution

2005-08-17 Thread Todd
Thanks. I tried to simplify a couple of things when I sent out the first email to make it easier for help. Sorry for the type-o. The single quotes wont work with this though: $hexval="011884455667733"; $newval='hba0-SCSI-target-id-7-name="$hexval"'; @output = `/usr/bin/perl -p -i -e "s/hba0-SCSI-

Finding matches and use of __END__ in a one-liner

2005-08-17 Thread KEVIN ZEMBOWER
I have a series of EZMLM configuration files in the ~alias directory that look like this: main:/var/qmail/alias# cat cire/config F:-aBCdEFGHiJKlmnOpQrStuVWXYZ X: D:/var/qmail/alias/cire T:/var/qmail/alias/.qmail-cire L:cire H:infoforhealthx.org C: 0: 3: 4: 5: 6: 7: 8: 9: main:/var/qmail/alias#

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread Manav Mathur
>I have a series of EZMLM configuration files in the ~alias directory that look like this: >main:/var/qmail/alias# cat cire/config >F:-aBCdEFGHiJKlmnOpQrStuVWXYZ >X: >D:/var/qmail/alias/cire >T:/var/qmail/alias/.qmail-cire >L:cire >H:infoforhealthx.org main:/var/qmail/alias# >I want to find the

Re: converting to FLOATING_POINT..

2005-08-17 Thread Chris Charley
Vineet Pande wrote: Thanks Rex: Please help me in knowing one more related thing. I have from this script of mine an output like this: 0.00.00 0.460.37 0.8106.29 1.2140.56 1.6168.75 2.0186.37 2.4207.82 2.8225.45 3.2235.88 3.6245.55 4.0250.61 4.42

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread KEVIN ZEMBOWER
Manav, thanks for your suggestion. Your suggestion came so close to solving my problem: main:/var/qmail/alias# for x in `find -name config`; do { perl -ne "($name)=/L:(.*)$/; ($add)=/H:(.*)$/; END { print [EMAIL PROTECTED]; }" $x; } done ARRAY(0x8160124)ARRAY(0x8160124)ARRAY(0x8160124)ARRAY(0x81

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread Manav Mathur
- Original Message - From: "KEVIN ZEMBOWER" <[EMAIL PROTECTED]> To: Sent: Thursday, August 18, 2005 1:06 AM Subject: Finding matches and use of __END__ in a one-liner I have a series of EZMLM configuration files in the ~alias directory that look like this: main:/var/qmail/alias# cat ci

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread KEVIN ZEMBOWER
Thanks, Manav, that pretty much did it. One slight change and this works fine: main:/var/qmail/alias# for x in `find -name config`; do { perl -ne '$name=$1 if /^L:(.*)$/; $add=$1 if /^H:(.*)$/; END{print "[EMAIL PROTECTED]"}' $x; } done Thank you for your kind help. -Kevin >>> Manav Mathur <[E

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread John W. Krahn
KEVIN ZEMBOWER wrote: > I have a series of EZMLM configuration files in the ~alias directory that > look like this: > main:/var/qmail/alias# cat cire/config > F:-aBCdEFGHiJKlmnOpQrStuVWXYZ > X: > D:/var/qmail/alias/cire > T:/var/qmail/alias/.qmail-cire > L:cire > H:infoforhealthx.org > C: > 0: >

Re: Quote Problem during Substitution

2005-08-17 Thread John W. Krahn
Todd wrote: > > I tried to simplify a couple of things when I sent out the first email to > make it easier for help. Sorry for the type-o. The single quotes wont work > with this though: > > $hexval="011884455667733"; > $newval='hba0-SCSI-target-id-7-name="$hexval"'; > @output = `/usr/bin/perl -p

Re: Quote Problem during Substitution

2005-08-17 Thread John Doe
Todd am Mittwoch, 17. August 2005 17.45: > Thanks. > > I tried to simplify a couple of things when I sent out the first email to > make it easier for help. Sorry for the type-o. The single quotes wont work > with this though: > > $hexval="011884455667733"; The choosed quoting operator above won't

Re: Finding matches and use of __END__ in a one-liner

2005-08-17 Thread John W. Krahn
John W. Krahn wrote: > KEVIN ZEMBOWER wrote: >>I have a series of EZMLM configuration files in the ~alias directory that >>look like this: >>main:/var/qmail/alias# cat cire/config >>F:-aBCdEFGHiJKlmnOpQrStuVWXYZ >>X: >>D:/var/qmail/alias/cire >>T:/var/qmail/alias/.qmail-cire >>L:cire >>H:infofor

Re: Find string ending with %

2005-08-17 Thread Binish A R
Timothy Johnson wrote: John W. Krahn wrote: [ message rearranged in chronological order. Please do not top-post ] No. If I'm responding to a message in this format, I'll use this format, but there's nothing illegitimate about top-posting. It is the email format that

How to change the date/time of PC

2005-08-17 Thread Xiaofang Zhou
Hi, I can't find any perl function to change the date/time of PC. The only way I found is `cmd.exe /C date $today`, call DOS function. Any one can give me a clue? Thanks, Xiaofang Zhou [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Re: How to change the date/time of PC

2005-08-17 Thread Binish A R
Xiaofang Zhou wrote: Hi, I can't find any perl function to change the date/time of PC. The only way I found is `cmd.exe /C date $today`, call DOS function. Any one can give me a clue? Thanks, Xiaofang Zhou [EMAIL PROTECTED] I don't think there is any perl fu

Re: Perl Net::Pcap loop hang ??

2005-08-17 Thread Michael Gale
Hey, Thanks I discovered the same thing this morning, in the test directory (/t) there is a README that stats the loop test waits for 10 packets to be received to finish. So by generating network traffic it finished. My stats test did fail, for now I just ran a force install, but I am open

perl app as a service ?

2005-08-17 Thread Michael Gale
Hello, In the past I have usually written apps that run from start to finish and then exit. I now need to write a small app that idealy will continue to run as long as the machine is :) It needs to make a db, pull some data and do X with the data. Then sleep for 90 seconds and repeat the pro

Re: perl app as a service ?

2005-08-17 Thread Rex Rex
If you are in Windows OS, then you can code your program to be a Windows native service. You nee to have Win32::Daemon and take a look at this URL: http://www.roth.net/perl/Daemon/ Cheers, Rex On 8/17/05, Michael Gale <[EMAIL PROTECTED]> wrote: > Hello, > >In the past I have usually wr

Re: converting to FLOATING_POINT..

2005-08-17 Thread Chris Charley
[...] Hi Vineet You could format *pretty* by using sprintf() instead of print. I would do it like below. use strict; use warnings; my $mdout_file = "mdout.txt"; my $mdout_xtemp_file = "temp.txt"; open IN, $mdout_file or die; open OUT, ">$mdout_xtemp_file" or die; while (){ if (/TEMP

Re: Perl Net::Pcap loop hang ??

2005-08-17 Thread John W. Krahn
Michael Gale wrote: > Hey, Hello, > Thanks I discovered the same thing this morning, in the test > directory (/t) there is a README that stats the loop test waits for 10 > packets to be received to finish. > > So by generating network traffic it finished. > > My stats test did fail, for now

RE: How to change the date/time of PC

2005-08-17 Thread Timothy Johnson
The only way to do this without shelling out to the net time command is to use the SetLocalTime() API from Kernel32.dll. #Mad, mad props to G.Knauf, [EMAIL PROTECTED] #He has a script on the Internets that I used as an example use strict; use warnings; use Wi

regex - no field seperator

2005-08-17 Thread Keenan, Greg John (Greg)** CTR **
Hi, I have the following data that I'm trying to parse into an array. There are 19 fields but with hosts 5 & 6 fields 6 & 7 do not have any space between them. This is how I get it from the OS and have no control over it. The maximum length for field 6 is 7 chars and field 7 is 6 chars. 200

Re: converting to FLOATING_POINT..

2005-08-17 Thread Chris Charley
Chris Charley wrote The solution above *assumes* that you would know beforehand the widths you want for each column (determined by the largest number in each column you want to format). The solution below allows you to determine the greatest width required programmatically using the max() fun