Re: How can I find the module version?

2003-06-11 Thread Tassilo von Parseval
On Tue, Jun 10, 2003 at 09:32:53AM -0400 Rick Ressegger wrote: If I want to know what version of a module is already installed on a system, how can I disclose this? Either use Janek's suggestion or ask for the value of $VERSION for the module in question: perl -MSome::Module -e 'warn

Find regex in Start/Stop segments

2003-06-11 Thread Harry Putnam
I use a homeboy data base technique to keep info about the scripts I write and other typse of stuff too. Here I'm just dealing with scripts. Its a simple format to enter key information about what a script does. Looks like: # Keywords: SOME WORDS # body # body # DATE # I've written various

Re: References...

2003-06-11 Thread Hamish Whittal
Thanks Rob, this has been very helpful. I wanted to know why the second form is an abuse of perl. Since I'm new to perl, it is helpful to kn ow what is good programming practise. Tx. H On Tue, 2003-06-10 at 15:39, Rob Dixon wrote: Hamish Whittal wrote: Hi All, I'm still a little

Re: Find regex in Start/Stop segments

2003-06-11 Thread Tassilo von Parseval
On Tue, Jun 10, 2003 at 11:49:25PM -0700 Harry Putnam wrote: I use a homeboy data base technique to keep info about the scripts I write and other typse of stuff too. Here I'm just dealing with scripts. Its a simple format to enter key information about what a script does. Looks like:

regexp

2003-06-11 Thread Jaschar Otto
Hi, i've got a problem with regexp, i have a multiline string like this is a multi line string and i want to do a regexp that replaces everything that is NOT a,b,c or d with \s, except \n of course. i got something like $string =~ s/![abcd]//g; but that doesn't work, maybe because it

Re: regexp

2003-06-11 Thread Janek Schleicher
Jaschar Otto wrote at Wed, 11 Jun 2003 11:53:11 +0200: i've got a problem with regexp, i have a multiline string like this is a multi line string and i want to do a regexp that replaces everything that is NOT a,b,c or d with \s, except \n of course. \s is not one character, it

Re: regexp

2003-06-11 Thread Jaschar Otto
Hi \s is not one character, it stands usually for a whole character class! Do you mean an empty string () or just a blank ( ) instead? i ment a blank ( ). character class negation works with [^...], in your case it would be $string =~ s/[^abcd]//g; Thanks a lot, that worked perfect, maybe i was

Global config file....this time defining modules to use...

2003-06-11 Thread Hamish Whittal
Hi All, I have a module OraMod.pm that exports some subroutines I also have Common.pm which sets up a whole host of environment variables for use throughout all the modules that I have created. What I now want to do is, instead of placing the use OraMod qw(sub1, sub2, sub3) at the top of

File::Copy - Additional Parameters?

2003-06-11 Thread Ben Crane
Hi all, Anyone know if the perl module File::Copy can handle date checks? Or whether there is another module that only deals with copying files that are newer than the ones they are over-writing? Similar to the Xcopy /D: command [I don't want to use a batch file at the moment in case someone

RE: DNS Lookup

2003-06-11 Thread Bob Showalter
Airman wrote: Does anyone know how to reference different DNS servers when using gethostbyname. I want to check up to three different nameserver for consistency checking. Use Net::DNS module instead. gethostbyname() isn't really designed for that kind of thing. -- To unsubscribe, e-mail:

printing a hash

2003-06-11 Thread Stuart White
I have a hash called fouls. Within that hash, there are other hashes called offensive, personal, and shooting. The keys to those hashes are names, like Smith, Rodriguez, and Chan. and the values to those names are numbers. I think if I wanted to access the number of offensive fouls Chan

Re: pattern matching

2003-06-11 Thread Rob Dixon
Chern Jian Leaw wrote: From: Rob Dixon Chern Jian Leaw wrote: I have a text file below which is simply an output from the UNIX utility rpcinfo: 181 udp 55734 walld program 18 version 1 ready and waiting 1073741 udp 64018 rpcinfo: RPC:

Re: printing a hash

2003-06-11 Thread Rob Dixon
Hi Stuart. This project of yours is coming along nicely! Stuart White wrote: I have a hash called fouls. Within that hash, there are other hashes called offensive, personal, and shooting. The keys to those hashes are names, like Smith, Rodriguez, and Chan. and the values to those names

very beginner

2003-06-11 Thread DiGregorio, Dave
Could someone direct me to the correct module to use for monitoring an Internet connection? I just want to see the IP addresses of the machines trying to get into my PC. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: regexp

2003-06-11 Thread James Edward Gray II
On Wednesday, June 11, 2003, at 05:14 AM, Jaschar Otto wrote: $string =~ s/[^abcd]//g; Thanks a lot, that worked perfect, Transliterate is probably a better choice for this kind of thing. It's certainly more efficient. You would use it like this: $string =~ tr/abcd/ /c; James -- To

RE: very beginner

2003-06-11 Thread Bakken, Luke
Steps: 1. Install Windump http://windump.polito.it/ 2. Watch logfile, or write perl script to parse log file. Luke -Original Message- From: DiGregorio, Dave [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 7:04 AM To: Bakken, Luke Subject: RE: very beginner Win ME

RE: regexp

2003-06-11 Thread Dan Muey
On Wednesday, June 11, 2003, at 05:14 AM, Jaschar Otto wrote: $string =~ s/[^abcd]//g; Thanks a lot, that worked perfect, Transliterate is probably a better choice for this kind of thing. It's certainly more efficient. You would use it like this: Just curious, how is it more

Re: Global config file....this time defining modules to use...

2003-06-11 Thread Peter Scott
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Hamish Whittal) writes: Hi All, I have a module OraMod.pm that exports some subroutines I also have Common.pm which sets up a whole host of environment variables for use throughout all the modules that I have created. What I now want to do

Re: regexp

2003-06-11 Thread James Edward Gray II
On Wednesday, June 11, 2003, at 09:21 AM, Dan Muey wrote: On Wednesday, June 11, 2003, at 05:14 AM, Jaschar Otto wrote: $string =~ s/[^abcd]//g; Thanks a lot, that worked perfect, Transliterate is probably a better choice for this kind of thing. It's certainly more efficient. You would use

Re: regexp

2003-06-11 Thread Rob Dixon
Dan Muey wrote: On Wednesday, June 11, 2003, at 05:14 AM, Jaschar Otto wrote: $string =~ s/[^abcd]//g; Thanks a lot, that worked perfect, Transliterate is probably a better choice for this kind of thing. It's certainly more efficient. You would use it like this: Just

Re: printing a hash

2003-06-11 Thread Stuart White
--- Rob Dixon [EMAIL PROTECTED] wrote: Hi Stuart. This project of yours is coming along nicely! Thanks, I'm getting some help from a tutor and you all on this list, which is helping me move along much faster than I could have done by myself. Stuart White wrote: I have a hash called

RE: regexp

2003-06-11 Thread Dan Muey
The caret at the start of a character class negates the sense of the class, so /[abcd]/ matches a character which is any one of the four letters 'a', 'b', 'c' or 'd'. /[^abcd]/ will match any single character except these four. In the expression Ooo yeah the brackets change the

Re: printing a hash

2003-06-11 Thread Rob Dixon
Stuart White wrote: --- Rob Dixon [EMAIL PROTECTED] wrote: Stuart White wrote: I have a hash called fouls. Within that hash, there are other hashes called offensive, personal, and shooting. The keys to those hashes are names, like Smith, Rodriguez, and Chan. and the values to

Re: File::Copy - Additional Parameters?

2003-06-11 Thread Rob Dixon
Hi Ben Ben Crane wrote: Anyone know if the perl module File::Copy can handle date checks? Or whether there is another module that only deals with copying files that are newer than the ones they are over-writing? Similar to the Xcopy /D: command [I don't want to use a batch file at the

RE: File::Copy - Additional Parameters?

2003-06-11 Thread Tim Johnson
You could always use stat() on the files to decide which ones you want to copy... -Original Message- From: Ben Crane [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 4:31 AM To: [EMAIL PROTECTED] Subject: File::Copy - Additional Parameters? Hi all, Anyone know if the perl

Re: Find regex in Start/Stop segments

2003-06-11 Thread Harry Putnam
Tassilo von Parseval [EMAIL PROTECTED] writes: You don't have to keep track of the line numbers yourself. Perl offers the special variable $. for that. An awkism I guess, hold over from awk use. Thanks for the tips. I'd probably write it like that: Quite a lot shorter... and to the point.

Changing UID/GID

2003-06-11 Thread tsg
Hi everybody! Could You pease point me where I can get answers following questions: 1. How can I now the UID of the user who started perl-script? 2. How can I change UID/GID the script is running under. I need to start script with root privilegies and when drop them to apache.apache. Thanks in

Re: printing a hash

2003-06-11 Thread Stuart White
snip Conceptually, what you have is a tree. There are three branches from the root, one for each foul type, and each of these is split into a further three branches, one for each player. Like this: --Rodriguez{numFouls} --offensive--Chan{numFouls}

Re: Changing UID/GID

2003-06-11 Thread Shlomi Fish
On Wed, 11 Jun 2003, tsg wrote: Hi everybody! Could You pease point me where I can get answers following questions: 1. How can I now the UID of the user who started perl-script? Try $ (or $UID or $REAL_USER_ID with use English) for the real user id. Try $ or $EUID or $EFFECTIVE_USER_ID with

Re: printing a hash

2003-06-11 Thread Rob Dixon
Stuart White wrote: Conceptually, what you have is a tree. There are three branches from the root, one for each foul type, and each of these is split into a further three branches, one for each player. Like this: --Rodriguez{numFouls}

Re: Find regex in Start/Stop segments

2003-06-11 Thread John W. Krahn
Tassilo Von Parseval wrote: On Tue, Jun 10, 2003 at 11:49:25PM -0700 Harry Putnam wrote: ## Set a marker to know when we are in a new file $fname_for_line_cnt = ''; for (@files) { chomp; I don't think that the entries in @ARGV contain newlines at the end. Actually I know they

Re: printing a hash

2003-06-11 Thread James Edward Gray II
On Wednesday, June 11, 2003, at 01:21 PM, Rob Dixon wrote: Time to go and play with hashes for a while! Start with the simplest imaginable hash my %hash; $hash{A} = 1; and dump it. Then add additional data, then additional levels, and get a feel for what the operations are doing. Just

Re: very beginner

2003-06-11 Thread John W. Krahn
Dave Digregorio wrote: Could someone direct me to the correct module to use for monitoring an Internet connection? I just want to see the IP addresses of the machines trying to get into my PC. Get a progam like Ethereal: http://www.ethereal.com/ :-) John -- use Perl; program fulfillment

mathing only one type of characters

2003-06-11 Thread Pedro Antonio Reche
Hi All; I would like to match a string if it has only cero or more of a defined set of characters. For example: if GACT are the characters, then GACTNGACT ## This string should not be matched because it has the extra character N GACCC ## This could be matched; Any help to solve this

File not getting written

2003-06-11 Thread Rob Das
Hi All: I added the following line to my program: $/ = \65536; This was because I'm running out of memory when slurping entire files into memory (potentially hundreds of meg). However, the (separate) log file I'm writing afterwards is not getting created - nor am I getting any error messages.

Two lists...

2003-06-11 Thread James Kelty
Say I have two large lists of names (uid's). I would like to look at both of these files and make sure that a name (uid) doesn't appear in BOTH files. Just one or the other. Not sure how to handle that. Any ideas? Thanks. -James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

RE: very beginner

2003-06-11 Thread Kipp, James
Could someone direct me to the correct module to use for monitoring an Internet connection? I just want to see the IP addresses of the machines trying to get into my PC. Get a progam like Ethereal: http://www.ethereal.com/ or: netstat tcpdump lsof and roll your own with Socket

Re: mathing only one type of characters

2003-06-11 Thread Rob Dixon
Pedro Antonio Reche wrote: Hi All; I would like to match a string if it has only cero or more of a defined set of characters. For example: if GACT are the characters, then GACTNGACT ## This string should not be matched because it has the extra character N GACCC ## This could be

Re: File not getting written

2003-06-11 Thread Jenda Krynicky
From: Rob Das [EMAIL PROTECTED] I added the following line to my program: $/ = \65536; It'd be better to use read FILE, $buffer, 65536; and leave $/ alone. Keep in mind that $/ is global and affects all filehandles you try to read from using the diamond operator (FILE). So if

Re: File not getting written

2003-06-11 Thread Rob Dixon
Rob Das wrote: Hi All: I added the following line to my program: $/ = \65536; This was because I'm running out of memory when slurping entire files into memory (potentially hundreds of meg). However, the (separate) log file I'm writing afterwards is not getting created - nor am I getting

Re: Two lists...

2003-06-11 Thread Rob Dixon
James Kelty wrote: Say I have two large lists of names (uid's). I would like to look at both of these files and make sure that a name (uid) doesn't appear in BOTH files. Just one or the other. Not sure how to handle that. Any ideas? The short answer is perldoc -q duplicate The long one is,

Re: trim function

2003-06-11 Thread Rob Dixon
Jair Santos wrote: Hi all, say that use strict;# always use warnings; # usually $directory = C:\\directory\\*.* Use single quotes for cuter code. my $directory = 'C:\directory\*.*'; and I am trying to remove the *.* from the end using $directory = trim($directory);

Re: printing a hash

2003-06-11 Thread Rob Dixon
James Edward Gray II wrote: On Wednesday, June 11, 2003, at 01:21 PM, Rob Dixon wrote: Time to go and play with hashes for a while! Start with the simplest imaginable hash my %hash; $hash{A} = 1; and dump it. Then add additional data, then additional levels, and get a

RE: trim function

2003-06-11 Thread Dan Muey
Hi all, say that $directory = C:\\directory\\*.* and I am trying to remove the *.* from the end using $directory = trim($directory); where trim is sub trim { my( $result) = @_; $result =~ s/^\s+(.*?)\s+$/$1/; Because . And * have special meanings in a regex.

hex to dec and dec to hex

2003-06-11 Thread Ken Lehman
Is there an easy way to go back and forth between decimal and hex in perl. I know of the hex function which solves my hex to dec problem but how about a dec-hex function or module? I need the value which is why printf isn't working for me. Thanks for any help. -Ken

RE: hex to dec and dec to hex

2003-06-11 Thread Charles K. Clarkson
Ken Lehman [mailto:[EMAIL PROTECTED] : : Is there an easy way to go back and forth between : decimal and hex in perl. I know of the hex function : which solves my hex to dec problem but how about a : dec-hex function or module? I need the value which : is why printf isn't working for me.

Re: very beginner

2003-06-11 Thread Mark G
Here is an example that i posted some time ago, : ~~ cut use Socket; use Fcntl; use POSIX; my $PORT=2100; my $proto=getprotobyname('tcp'); socket($socket,AF_INET,SOCK_STREAM,$proto) || die couldn't get socket: $!\n; bind($socket,sockaddr_in($PORT,INADDR_ANY)) || die couldn't bind: $!\n;;

Re: $SIG{__WARN__}

2003-06-11 Thread John W. Krahn
James Edward Gray II wrote: On Wednesday, June 11, 2003, at 05:27 PM, James Edward Gray II wrote: I'm setting the warning signal ($SIG{__WARN__}) to my own handler, redirecting warnings to my log file. It is working. I can see the call come through, but the passed @_ is completely

Re: mathing only one type of characters

2003-06-11 Thread Janek Schleicher
Pedro Antonio Reche wrote at Wed, 11 Jun 2003 13:38:18 -0500: I would like to match a string if it has only cero or more of a defined set of characters. For example: if GACT are the characters, then GACTNGACT ## This string should not be matched because it has the extra character N

RE: File not getting written

2003-06-11 Thread Rob Das
Hi Rob: I'm trying to merge a whole bunch of files (possibly tens of thousands) into one file. Here's my code (with the error checking removed for readability): opendir(INDIR, $indir); @logfile=grep(/$mask/i, readdir INDIR); closedir(INDIR); [EMAIL PROTECTED]; # number of files matching mask

Re: References...

2003-06-11 Thread R. Joseph Newton
Hamish Whittal wrote: Thanks Rob, this has been very helpful. I wanted to know why the second form is an abuse of perl. Since I'm new to perl, it is helpful to kn ow what is good programming practise. Because it adds characters and notation that serve no purpose, which serves no purpose.