Perl-Tk Menuframe (maybe OT)

2003-06-11 Thread Jaschar Otto
hi, i know there is a perl tk mailinglist but i don't want to do all this subscribe stuff atm so i ask here since you all helped me a lot already (thanks a lot again) :-) i've got a perl/tk script including a Menu frame use Tk; $mw = MainWindow->new; $mw->title("whatever")

Comparing timestamp of 2 files

2003-06-11 Thread Amit Sharma
Hi All, I need your help to compare the file timestamp of 2 different files, Please suggest how can I do this in perl. Thanks & regards, Amit.

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. T

Re: printing a hash

2003-06-11 Thread Stuart White
Well, I got the out put that I wanted. the use Data::Dumper; call really helped with my debugging, thanks for the tip. I understand what's going on except for the printing and the foreach loops, can someone break that down for me? Also, any other resources on foreach loops? Thanks in advance,

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 open

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 > charact

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 compl

Re: $SIG{__WARN__}

2003-06-11 Thread James Edward Gray II
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 empty. Shouldn't I be able to get the

Re: Two lists...

2003-06-11 Thread royce . wells
You could also do something like this. foreach $uid (%file1) { if ( ($file1{$uid} =~ /$file2{$uid}/) || ($file2{$uid} =~ $file1 {$uid})) { print "A duplicate has been located\n"; } } "The right word may be effective, but no word was ever as effective as a right

$SIG{__WARN__}

2003-06-11 Thread James Edward Gray II
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 empty. Shouldn't I be able to get the warning message out of there? Thanks for any insights. James -- To

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: 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. Ar

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: 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 mea

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 > > lev

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: 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 i

trim function

2003-06-11 Thread Jair Santos
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/; $result =~ s/\s//g; return $result; } Can anybody point me out why

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 ge

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 (). So if possible

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 c

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

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 com

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. If

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 pro

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 fulfillme

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 wan

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

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: 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

Re: printing a hash

2003-06-11 Thread Stuart White
> 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}

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: 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 poi

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 modu

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

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 t

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 c

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 c

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

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 it

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

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 i

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

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 unsubscr

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: 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 > nam

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

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 committe

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: [

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 want

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 all

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, m

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

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: 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

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 con