Re: undefined symbol: Perl_Gthr_key_ptr

2002-07-15 Thread drieux
On Monday, July 15, 2002, at 10:42 , Sajith K wrote: > i am trying to use perl with a public domain tool. > on executiong use PLSTAF; i am getting the following > error: > > /usr/bin/perl: error while loading shared > libraries: /usr/lib/perl5/5.6.0/libPLSTAF.so: > undefined symbol: Perl_Gthr_ke

Re: perl modules?

2002-07-15 Thread drieux
On Monday, July 15, 2002, at 11:01 , Jeff 'japhy' Pinyan wrote: > On Jul 15, chad kellerman said: > >> I am trying to include my own perl module that is outside the regular >> @INC array. But my perl script still can not find it.. Any suggestions >> would be appreciated... to amp on Jeff's no

Re: Trapping "Ctrl C"

2002-07-15 Thread Paul Johnson
On Mon, Jul 15, 2002 at 04:36:59PM -0700, Peter Scott wrote: > Please don't do I/O from a signal handler, it sets a bad example. Well, not for a few more days anyway, by which time everyone will surely have upgraded to the forthcoming 5.8.0 release :-) -- Paul Johnson - [EMAIL PROTECTED] http:

Re: Trapping "Ctrl C"

2002-07-15 Thread Peter Scott
At 12:01 AM 7/16/02 +0100, Daniel Gardner wrote: >Max Clark wrote: > > > I'm looking for a way to run an operation (like a while (<>) loop for > > example) until the user presses "ctrl-c". Except instead of ending the > > perl script I want to trap the "ctrl-c" and present the user a menu of > > o

Re: System commands..

2002-07-15 Thread drieux
On Monday, July 15, 2002, at 11:53 , Vishal Kapoor wrote: > thanx for the previous help > can we use system commands in a perl program , commands such as ls or grep > > im sure we can , can someone point out how ??? there are really two issues here you will want to resolve, a

Re: Trapping "Ctrl C"

2002-07-15 Thread Daniel Gardner
Max Clark wrote: > I'm looking for a way to run an operation (like a while (<>) loop for > example) until the user presses "ctrl-c". Except instead of ending the > perl script I want to trap the "ctrl-c" and present the user a menu of > options. This is very minimal: , | $SIG{INT} = sub

RE: System commands..

2002-07-15 Thread Timothy Johnson
You'll want to check the docs for the three most common, which are the system(), exec(), and backticks ``. Brief description: system() -- executes the system command inside the parentheses and returns the exit code of the command to the perl script. exec() -- executes the system command inside

Re: System commands..

2002-07-15 Thread Daniel Gardner
Vishal Kapoor wrote: > thanx for the previous help > can we use system commands in a perl program , commands such as ls or grep > > im sure we can , can someone point out how ??? You don't often see it mentioned, but there is a core module called Shell.pm - try perldoc Shell to see wh

Re: undefined symbol: Perl_Gthr_key_ptr

2002-07-15 Thread Paul Johnson
On Mon, Jul 15, 2002 at 10:42:35AM -0700, Sajith K wrote: > i am trying to use perl with a public domain tool. > on executiong use PLSTAF; i am getting the following > error: > > /usr/bin/perl: error while loading shared > libraries: /usr/lib/perl5/5.6.0/libPLSTAF.so: > undefined symbol: Perl_Gt

Re: Pert to test web server is alive

2002-07-15 Thread Jenda Krynicky
From: Jason Ya hoo <[EMAIL PROTECTED]> > Do you have any way or perl code to test Web Server is > still alive instead of using Internet Browser to > browse Web Server page every period. Thank you for > your help. I use something like this: use LWP::UserAgent; my $ua = new LWP::UserAgent; $

Re: Trapping "Ctrl C"

2002-07-15 Thread Paul Johnson
On Mon, Jul 15, 2002 at 10:38:36AM -0700, Max Clark wrote: > Hi. > > I'm looking for a way to run an operation (like a while (<>) loop for > example) until the user presses "ctrl-c". Except instead of ending the perl > script I want to trap the "ctrl-c" and present the user a menu of options. >

Re: Reading from a bunch of files.

2002-07-15 Thread Paul Johnson
On Mon, Jul 15, 2002 at 02:43:14PM -0700, John W. Krahn wrote: > Vishal Kapoor wrote: > > > > I want to read a few files and search for a particular word. I want to then > > print a list of all the files with that word. > > Any ideas ?? > > perl -lne'/\bparticular\b/&&print($ARGV)&&close(ARGV)'

Pert to test web server is alive

2002-07-15 Thread Jason Ya hoo
Do you have any way or perl code to test Web Server is still alive instead of using Internet Browser to browse Web Server page every period. Thank you for your help. __ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.c

System commands..

2002-07-15 Thread Vishal Kapoor
thanx for the previous help can we use system commands in a perl program , commands such as ls or grep im sure we can , can someone point out how ??? Vishal Kapoor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

undefined symbol: Perl_Gthr_key_ptr

2002-07-15 Thread Sajith K
i am trying to use perl with a public domain tool. on executiong use PLSTAF; i am getting the following error: /usr/bin/perl: error while loading shared libraries: /usr/lib/perl5/5.6.0/libPLSTAF.so: undefined symbol: Perl_Gthr_key_ptr could you please help me out with this problem ? regards sa

Trapping "Ctrl C"

2002-07-15 Thread Max Clark
Hi. I'm looking for a way to run an operation (like a while (<>) loop for example) until the user presses "ctrl-c". Except instead of ending the perl script I want to trap the "ctrl-c" and present the user a menu of options. Is this possible? Thanks, Max -- To unsubscribe, e-mail: [EMAIL PROTE

RE: Using win32::ChangeNotify

2002-07-15 Thread Rupert Heesom
Interesting..!! Thanks for the reply. I'll try that approach. Rather strange necessity though I think! Thanks for your effort! Regs Rupert Heesom Asst Distribution Engineer Adventist World Radio -Original Message- From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] Sent: 15 July 2002 1

Re: unlinking all files that contain a specified string

2002-07-15 Thread John W. Krahn
James wrote: > > hi, all! Hello, > friday while trying to clean up a directory, i thought i > could bang out a quick-and-dirty perl script that would > let me achieve what i needed, to delete all text files in > a subdirectory that contain a specified string. i was able > to use the perl comman

Re: Newbie Stupid Question!

2002-07-15 Thread John W. Krahn
Simopoulos wrote: > > Hi All, Hello, > I'm a newbie just starting out learning Perl. > My problem is I have a bunch of files that are (.doc) files, and I want to rename > the files (.data). > I also want move then to another directory, but I don't really want to destroy or > change the old ones

Re: Reading from a bunch of files.

2002-07-15 Thread John W. Krahn
Vishal Kapoor wrote: > > I want to read a few files and search for a particular word. I want to then > print a list of all the files with that word. > Any ideas ?? perl -lne'/\bparticular\b/&&print($ARGV)&&close(ARGV)' yourfiles* John -- use Perl; program fulfillment -- To unsubscribe, e-ma

Re: Any difference in this?

2002-07-15 Thread Tanton Gibbs
Oh, well in that case I think the important point is to not do the second map. Make your glob string up ahead of time and incorporate all the elements if possible. - Original Message - From: "Nikola Janceski" <[EMAIL PROTECTED]> To: "'Janek Schleicher'" <[EMAIL PROTECTED]>; <[EMAIL PROTEC

Re: script too slow?

2002-07-15 Thread Janek Schleicher
Paul Tremblay wrote at Mon, 15 Jul 2002 18:45:21 +0200: > On Mon, Jul 15, 2002 at 10:26:25AM +0200, Janek Schleicher wrote: > > >> To increase speed, we can make also a lookahead statement: >> >> my @tokens = split / ( \\ (?=\S)# there's never a whitespace >>

RE: Any difference in this?

2002-07-15 Thread Nikola Janceski
heheh.. and it still goes on. Actually I am using different directories in the qw() with *, and I am doing a different substitution (not for the basenames). That's why I said I am getting more than enough info. Efforts can be spent elsewhere to help the less fortunate. Thanx again, Nikola Jance

Re: script too slow?

2002-07-15 Thread Janek Schleicher
John W. Krahn wrote at Mon, 15 Jul 2002 15:16:38 +0200: > Janek Schleicher wrote: >> >> John W. Krahn wrote at Sun, 14 Jul 2002 13:45:19 +0200: >> > >> > my @tokens = split /({\\[^\s}{]+|\\[^\s\\}]+|\\[\\}]|})/, $line; >> > ^^ ^^ ^^ >> >> Perhaps we can si

Re: parsing

2002-07-15 Thread Janek Schleicher
Lz wrote at Mon, 15 Jul 2002 17:54:03 +0200: > In some cases I will have to read the file and I will encounter a line similar to >the below. > "Test,Test (test,ex1)" <[EMAIL PROTECTED]> > > I will need to determine whether the line contains ..test.com. What is the best way >to determine > it?

RE: Any difference in this?

2002-07-15 Thread Janek Schleicher
Nikola Janceski wrote at Mon, 15 Jul 2002 21:16:09 +0200: > (better question) is there a better way to achieve the same result? > >> my @crap = map{ s/\.\w+$//; $_ } map { glob($_) } qw(*.pl *.pgp); It seems you want to get the basenames of the files. Express what you want in a natural way: us

RE: unlinking all files that contain a specified string

2002-07-15 Thread Timothy Johnson
I'm not sure if you want to find the string _in_ the file, or in the filename. #in the file use strict; opendir(DIR,"."); foreach(readdir DIR){ if(HasText($_)){ unlink $_; } } sub HasText{ my $file = $_[0]; open(FILE,"$file"); while(){ if($_ =~ /pa

Re: unlinking all files that contain a specified string

2002-07-15 Thread Tanton Gibbs
Ah, you'll probably want single quotes around the search string if it is multi word... my @found = `grep -ls '$search_string' *`; - Original Message - From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: "james" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, July 15, 2002 4:13 PM Subject

Re: unlinking all files that contain a specified string

2002-07-15 Thread Tanton Gibbs
What about (assuming *nix) use strict; my $search_string = "Whatever you want to find"; my @found = `grep -ls $search_string *`; chomp( @found ); unlink( @found ); or are you working under Windows? - Original Message - From: "james" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Mon

RE: Newbie Stupid Question!

2002-07-15 Thread Timothy Johnson
And don't forget the $^E variable, which will give you the OS-specific error, which can sometimes give you more info on why something failed. If you're using a Win32 system, you might also want to check out the Win32::FileOp module which can tie into your built-in Win32 APIs to do things like co

Re: Any difference in this?

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Randal L. Schwartz said: >Jeff> my @crap = grep s/\.\w+$//, glob("*.pl *.pgp"); > >my @crap = map /(.*?)(?:\.\w+)?$/, glob("*.pl *.pgp"); That does too much work, though. We're guaranteed an extension... my @crap = map /(.*)\./s, glob("*.pl *.pgp"); -- Jeff "japhy" Pinyan

unlinking all files that contain a specified string

2002-07-15 Thread james
hi, all! friday while trying to clean up a directory, i thought i could bang out a quick-and-dirty perl script that would let me achieve what i needed, to delete all text files in a subdirectory that contain a specified string. i was able to use the perl command unlink(filename) and grep manua

RE: Any difference in this?

2002-07-15 Thread Jenda Krynicky
From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> > On Jul 15, Jeff 'japhy' Pinyan said: > > >On Jul 15, Jenda Krynicky said: > > > >>> (better question) is there a better way to achieve the same > >>> result? > >> > >> my @crap = map{ s/\.\w+$//; $_ } glob( '*.pl *.pgp'); > > > >I'm so funny. > >

Re: Any difference in this?

2002-07-15 Thread Randal L. Schwartz
> "Jeff" == Jeff 'Japhy' Pinyan <[EMAIL PROTECTED]> writes: Jeff> On Jul 15, Jenda Krynicky said: >>> (better question) is there a better way to achieve the same result? >> >> my @crap = map{ s/\.\w+$//; $_ } glob( '*.pl *.pgp'); Jeff> I'm so funny. Jeff> my @crap = grep s/\.\w+$//, glob

RE: Any difference in this?

2002-07-15 Thread Nikola Janceski
This is much more than I needed to know. Thanx for all the wonderful suggestions. I wish it was Friday. > -Original Message- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 3:38 PM > To: Jenda Krynicky > Cc: Beginners (E-mail) > Subject: RE: Any diffe

RE: Any difference in this?

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Jeff 'japhy' Pinyan said: >On Jul 15, Jenda Krynicky said: > >>> (better question) is there a better way to achieve the same result? >> >> my @crap = map{ s/\.\w+$//; $_ } glob( '*.pl *.pgp'); > >I'm so funny. > > my @crap = grep s/\.\w+$//, glob("*.pl *.pgp"); And here's a better re

RE: Any difference in this?

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Jenda Krynicky said: >> (better question) is there a better way to achieve the same result? > > my @crap = map{ s/\.\w+$//; $_ } glob( '*.pl *.pgp'); I'm so funny. my @crap = grep s/\.\w+$//, glob("*.pl *.pgp"); -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.

Re: Any difference in this?

2002-07-15 Thread Tanton Gibbs
What about: my @crap = map{ s/\.\w+$//; $_ } glob('*.{pl,pgp}'); Tanton - Original Message - From: "Nikola Janceski" <[EMAIL PROTECTED]> To: "Beginners (E-mail)" <[EMAIL PROTECTED]> Sent: Monday, July 15, 2002 3:16 PM Subject: RE: Any difference in this? > (better question) is there a b

RE: Any difference in this?

2002-07-15 Thread Jenda Krynicky
From: Nikola Janceski <[EMAIL PROTECTED]> > (better question) is there a better way to achieve the same result? > > > -Original Message- > > From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > > Sent: Monday, July 15, 2002 3:09 PM > > To: Beginners (E-mail) > > Subject: Any difference in

Re: Any difference in this?

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Nikola Janceski said: >Is there any speed difference in this? *cough* Benchmark.pm *cough* >my @crap = map { map { s/\.\w+$//; $_ } (glob($_)) } qw(*.pl *.pgp); >my @crap = map { s/\.\w+$//; $_ } map { glob($_) } qw(*.pl *.pgp); If there is, I suspect is negligable. You're doing th

Re: Any difference in this?

2002-07-15 Thread Peter Scott
At 03:08 PM 7/15/02 -0400, Nikola Janceski wrote: >Is there any speed difference in this? > >my @crap = map { > map{ s/\.\w+$//; $_ } (glob($_)) > } qw(*.pl *.pgp); > >and > >my @crap = map{ s/\.\w+$//; $_ } map { glob($_) } qw(*.pl *.pgp); Probably not, but Benchm

RE: Any difference in this?

2002-07-15 Thread Nikola Janceski
(better question) is there a better way to achieve the same result? > -Original Message- > From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 3:09 PM > To: Beginners (E-mail) > Subject: Any difference in this? > > > Is there any speed difference in this? > >

Re: setting permissions in open

2002-07-15 Thread Michael Fowler
On Thu, Jul 11, 2002 at 03:49:05PM -0400, Wiggins d'Anconia wrote: > however, I am still curious about open's ability to do this rather than > requiring a separate function, so can it? The open function can't accomplish what you want. The sysopen function, or IO::File's open, can nearly accompli

Any difference in this?

2002-07-15 Thread Nikola Janceski
Is there any speed difference in this? my @crap = map { map{ s/\.\w+$//; $_ } (glob($_)) } qw(*.pl *.pgp); and my @crap = map{ s/\.\w+$//; $_ } map { glob($_) } qw(*.pl *.pgp); Nikola Janceski Reading maketh a full man, conference a ready man, and writing an

Re: Newbie Stupid Question!

2002-07-15 Thread ccurtis
On Mon, Jul 15, 2002 at 01:35:15PM -0500, Akens, Anthony wrote: > On an unrelated note, something that is an immense help to me when using > "or die" is to put $! in the die statement, for example: > > or die "Can't open documents: $!"; > > The $! inserts the "human readable" error returned by t

RE: Newbie Stupid Question!

2002-07-15 Thread Akens, Anthony
Some comments from a fellow "newbie"... (and my first stab at being helpful) File::Copy is a great module, and can handle what you're trying to do. as others have already said) On an unrelated note, something that is an immense help to me when using "or die" is to put $! in the die statement, f

Re: Newbie Stupid Question!

2002-07-15 Thread royce . wells
It's no perl but it could work : ) make sure you start in the directory with the .doc files ls -1 *.doc | awk -F. '{printf("cp %s.doc /my/newpath/%s.data\n",$1,$1)}'| /bin/ksh

RE: Newbie Stupid Question!

2002-07-15 Thread Bob Showalter
> -Original Message- > From: Simopoulos [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 2:19 PM > To: [EMAIL PROTECTED] > Subject: Newbie Stupid Question! > > > Hi All, > I'm a newbie just starting out learning Perl. > My problem is I have a bunch of files that are (.doc) files,

RE: Newbie Stupid Question!

2002-07-15 Thread Nikola Janceski
use File::Copy; # add at the top of your script ## then change rename() to copy() and you should be good. > -Original Message- > From: Simopoulos [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 2:19 PM > To: [EMAIL PROTECTED] > Subject: Newbie Stupid Question! > > > Hi All, >

Newbie Stupid Question!

2002-07-15 Thread Simopoulos
Hi All, I'm a newbie just starting out learning Perl. My problem is I have a bunch of files that are (.doc) files, and I want to rename the files (.data). I also want move then to another directory, but I don't really want to destroy or change the old ones (.doc). What I've done so far doesn't wor

RE: Windows NT / 2000 Services

2002-07-15 Thread David . Wagner
Not sure from what list this was received ( on a number of them ), but here is one using Win32::Service. Change the 'x' within GetServices for the computer you are running on or want to get at. use Win32::Service; #set up a hash of known service states my %statcodeHash = ( '

Re: perl modules?

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, chad kellerman said: >I am trying to include my own perl module that is outside the regular >@INC array. But my perl script still can not find it.. Any suggestions >would be appreciated... >script.pm > >package Script; >BEGIN { > use Exporter; > @ISA = qw( Exporter ); >

Re: perl modules?

2002-07-15 Thread Mike(mickalo)Blezien
Chad, Try adding this at the top of the script: BEGIN { unshift(@INC, "./"); } instead of: push (@INC, '.'); >>On Mon, 15 Jul 2002 13:48:38 -0400, chad kellerman <[EMAIL PROTECTED]> wrote: >>Hello, >> >> Boy this stuff can get frustrating >> >> I am trying to include my own perl m

Re: perl modules?

2002-07-15 Thread Tanton Gibbs
You cannot use push(@INC, '.') in the normal way because it is a runtime function call and @INC must be changed at translation time. Instead use use lib '.'; at the top of your program. Tanton - Original Message - From: "chad kellerman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: M

perl modules?

2002-07-15 Thread chad kellerman
Hello, Boy this stuff can get frustrating I am trying to include my own perl module that is outside the regular @INC array. But my perl script still can not find it.. Any suggestions would be appreciated... Here is what I have... script.pm package Script; BEGIN { use Expo

Re: Windows NT / 2000 Services

2002-07-15 Thread Nigel Peck
There isn't. However, you might be able to get what you want from the net command. At a command prompt net services will tell you which services can be started, from which you could derive which ones are already started. You might be able to get some information from the registry but I'm not su

Weekly posting statistics - 28/2002

2002-07-15 Thread Felix Geerinckx
Weekly posting statistics for perl.beginners - week 28 of 2002. >From Monday 2002-07-08 to Sunday 2002-07-14 there were 472 articles posted (23522 lines) by 125 authors, giving an average 3.78 articles per author, and an average article length of 50 lpa. The average number of articles per day w

Re: require v. use

2002-07-15 Thread Connie Chan
Thousand thanks for this very valuable lesson. Some pieces of code are always better than reading 100s of docs. I am really understanding it now. My previous problem is what will be the difference of use inside require, require inside use, use inside use, and require inside require. The final ans

Re: script too slow?

2002-07-15 Thread Paul Tremblay
On Mon, Jul 15, 2002 at 10:26:25AM +0200, Janek Schleicher wrote: > > To increase speed, we can make also a lookahead statement: > > my @tokens = split / ( \\ (?=\S)# there's never a whitespace > (?: [^\s{}]+ | > [^\s\\}]+ | >

Restart a dead system command

2002-07-15 Thread Kevin Old
Hello all, I am currently streaming data from one of my servers via a custom client/server package we have. The client is written in C and is invoked by passing parameters to it. Currently I call it via the following syntax: myclient -start_time 12:00:00 -end_time 12:59:59 -host my_hostname_

Re: Windows NT / 2000 Services

2002-07-15 Thread Jenda Krynicky
From: "Hughes, James" <[EMAIL PROTECTED]> > Can anyone tell me if , and where there is an ascii file that holds > the current status of Windows NT and or 2000 services? This will help > me greatly with a perl project. Thanks! Why would the system keep a text file? See Win32::Services module. Je

Re: yet another text match and extract

2002-07-15 Thread Steven_Massey
Thanks - I've understood that -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: teaching examples (was "Re: Date and Time")

2002-07-15 Thread Peter Scott
At 09:13 AM 7/15/02 -0500, David T-G wrote: >I *think* I understand this. > > - 'my' defines a var for only this block and does not export to > subroutines Correct, although 'export' is the wrong term. This is why these are called 'lexical' variables; their scope is lexically defined (as

Re: Reading from a bunch of files.

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Vishal Kapoor said: >I want to read a few files and search for a particular word. I want to then >print a list of all the files with that word. my @hits; my $word = "japhy"; { local @ARGV = @files_to_search; while (<>) { if (index($_, $word) != -1) { push

Re: yet another text match and extract

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, [EMAIL PROTECTED] said: >$test="Fred Flinstone Betty and Barney (Class F) (bye)"; > >the length is variable, the only guarantee is that (Class x) exists, it is >the "Class x" that I want to extract. I have though of spliting on ( and >doing some further checking spliting. A simple reg

parsing

2002-07-15 Thread lz
Hi guys, In some cases I will have to read the file and I will encounter a line similar to the below. "Test,Test (test,ex1)" <[EMAIL PROTECTED]> I will need to determine whether the line contains ..test.com. What is the best way to determine it? Thanks!

yet another text match and extract

2002-07-15 Thread Steven_Massey
Hi all I have this problem (not medical) and it is very similar to others that have been resolved by this group, but I have spent 5 hours trying to relsolve it and getting nowhere... So $test="Fred Flinstone Betty and Barney (Class F) (bye)"; the length is variable, the only guarantee is tha

Re: Reading from a bunch of files.

2002-07-15 Thread ccurtis
On Mon, Jul 15, 2002 at 11:23:52PM +0800, Connie Chan wrote: > my @Files = ( . ); # List of file names here. > my @record = ( ); > my $pattern = "whatever"; > > foreach $file(@Files) > {open FH, $file; > while () > { push @record, $file if ($_ =~ /$pattern/ig) } > cl

Re: require v. use

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Connie Chan said: >When Perl read my code, if in 'use' case, would it load everything >existed in my modules, and won't care on how I defined the use >and require method in my if (...) {...} case ? Let's answer this by example. I'm going to produce several files here. ### ABC.pm

Re: Reading from a bunch of files.

2002-07-15 Thread Connie Chan
my @Files = ( . ); # List of file names here. my @record = ( ); my $pattern = "whatever"; foreach $file(@Files) {open FH, $file; while () { push @record, $file if ($_ =~ /$pattern/ig) } close (FH) } ## @record will probrably grabbed all the file names while con

Re: require v. use

2002-07-15 Thread Connie Chan
> When the file is included, the 'use's are executed IMMEDIATELY. The fact > that they're in functions doesn't matter. The require()s will not be > executed until (and unless) the functions they are in are called. > Thanks alot Jeff, I think I can target my question now... What I want to ask

Re: our %hash problem when require

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Connie Chan said: >> >## params.pl in /lib/ ## >> >my $lib{root} = 'C:/myLib/'; my $rt = $lib{root}; >> >my $lib{char_maps} = $rt."chinese/gbb5.map"; >> >my $lib{gb_map} = $rt."chinese/gb.map"; >> > >> >my $lib{temp} = $rt."temp/"; >> >> Warning: you cannot my() a subscript. >>

Re: our %hash problem when require

2002-07-15 Thread Connie Chan
> >## params.pl in /lib/ ## > >my $lib{root} = 'C:/myLib/'; my $rt = $lib{root}; > >my $lib{char_maps} = $rt."chinese/gbb5.map"; > >my $lib{gb_map} = $rt."chinese/gb.map"; > > > >my $lib{temp} = $rt."temp/"; > > Warning: you cannot my() a subscript. > > my $foo[$i]; # is a syntax error

Reading from a bunch of files.

2002-07-15 Thread Vishal Kapoor
Hi, I want to read a few files and search for a particular word. I want to then print a list of all the files with that word. Any ideas ?? Thanx.. Vishal Kapoor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: require v. use

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Connie Chan said: >sub A { > my ($case) = shift; > if ($case == 0) { require "lib0.pl" ; use somePm; use anotherPm ; &doSth(...) } > if ($case == 1) { require "lib1.pl" ; use somePm; use anotherPm ; &doSthEls(...) } > if ($case == 2) { require "lib2.pl" ; use somePm; use anotherPm

Re: require v. use

2002-07-15 Thread Connie Chan
> > As what I've learnt, 'use' is working during the compile time, > > where 'require' works at runtime, however, I have problem on > > understand this.. > > > > ### code ### > > sub A > > {my ($case) = shift; > > if ($case == 0) { require "lib0.pl" ; use somePm; use > > anotherPm

RE: our %hash problem when require

2002-07-15 Thread Bob Showalter
> -Original Message- > From: Connie Chan [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 10:30 AM > To: Bob Showalter; [EMAIL PROTECTED] > Subject: Re: our %hash problem when require > > > > The "our" declaration is for the current file only, so you need > > "our" in Script 1. >

Re: our %hash problem when require

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Connie Chan said: >>1 >Hehe... I forgot the 1; again , but I do have this in my code. =) > >> my $ref = \%lib1::abc; >How about if I don't package it ? and hopefully just make it looks >like %ENV ? For my case in real , that's something like this : > >## params.pl in /lib/ ## >my $lib{

Re: our %hash problem when require

2002-07-15 Thread Connie Chan
> The "our" declaration is for the current file only, so you need > "our" in Script 1. O seems I am hopeness... > $a is a "special" variable (used in sort blocks), so it gets a > "free pass" from use strict, just like all the other special > variables ($_, $/, etc.). Was you the guy tol

Re: our %hash problem when require

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Connie Chan said: >### Lib 1 ### >use strict; >our %abc; >$abc{a} = 1; >$abc{b} = 2; >### EOF Lib 1 ### > >### Lib 2 ### >use strict; >our $a = "ME"; >### EOF Lib 2 ### You've made the mistake of using $a (or $b) as a variable name. These two variables are protected from use strict '

RE: require v. use

2002-07-15 Thread Bob Showalter
> -Original Message- > From: Connie Chan [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 9:56 AM > To: [EMAIL PROTECTED] > Subject: require v. use > > > As what I've learnt, 'use' is working during the compile time, > where 'require' works at runtime, however, I have problem on

Re: our %hash problem when require

2002-07-15 Thread Connie Chan
>1 Hehe... I forgot the 1; again , but I do have this in my code. =) > my $ref = \%lib1::abc; How about if I don't package it ? and hopefully just make it looks like %ENV ? For my case in real , that's something like this : ## params.pl in /lib/ ## my $lib{root} = 'C:/myLib/'; my $rt = $lib{ro

Re: (?=\d) [Was Re: an error in a simple regexp]

2002-07-15 Thread Jeff 'japhy' Pinyan
On Jul 15, Kevin Pfeiffer said: >Jeff 'japhy' Pinyan writes: >[...] >> Here's a working regex: >> >> s/(\d)(?=\d)/$1./g; > >[converts 1234 to 1.2.3.4] > >> The (?=\d) looks ahead for a digit, without actually consuming it. > >What does that mean? Does it say, "match a digit, but always check to

RE: our %hash problem when require

2002-07-15 Thread Bob Showalter
> -Original Message- > From: Connie Chan [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 9:28 AM > To: [EMAIL PROTECTED] > Subject: our %hash problem when require > > > Some days ago, I've interested in the using of 'our' var, > however, I do have some problem on using this wit

Re: teaching examples (was "Re: Date and Time")

2002-07-15 Thread David T-G
drieux, et al -- ...and then drieux said... % % On Saturday, July 13, 2002, at 07:11 , David T-G wrote: % % In the main I like where this is generally going. Yay :-) % % A part of my argument with myself today has been about % % which is better? all 'teaching code' should be 'virgin

RE: deleting files

2002-07-15 Thread Bob Showalter
> -Original Message- > From: Michael Pastore [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 8:48 AM > To: [EMAIL PROTECTED] > Subject: deleting files > > > Hello All, > > Just a quick question on deleting files in Perl. > > I am trying to delete some files in a directory, but

require v. use

2002-07-15 Thread Connie Chan
As what I've learnt, 'use' is working during the compile time, where 'require' works at runtime, however, I have problem on understand this.. ### code ### sub A {my ($case) = shift; if ($case == 0) { require "lib0.pl" ; use somePm; use anotherPm ; &doSth(...) } if ($case ==

Re: our %hash problem when require

2002-07-15 Thread drieux
On Monday, July 15, 2002, at 06:27 , Connie Chan wrote: > Some days ago, I've interested in the using of 'our' var, > however, I do have some problem on using this with require. part of what is going on here, is essentially the transition model from how things were 'possible' in perl4 - before

RE: deleting files

2002-07-15 Thread Michael Pastore
Here is a post of what I used ...(Mike Blezien's example) my $DIR = 'D:/server/work'; my($deletefile,$removefile); opendir (DIR, "$DIR") or die $!; my @files = grep(/\.(dat|p1)/i,readdir(DIR)); closedir (DIR); foreach $removefile (@files) {

Re: Re[2]: How to use one sub in a perl package?

2002-07-15 Thread drieux
On Sunday, July 14, 2002, at 06:53 , chris wrote: > I inherited these packages and trying to find nice ways to steal some > code until I am able to rewrite the whole thing. oh dear My WORST NIGHTMARE Hopefully the prior coder left some design documents that outlined the relationships b

Re: deleting files

2002-07-15 Thread John W. Krahn
Michael Pastore wrote: > > Hello All, Hello, > Just a quick question on deleting files in Perl. > > I am trying to delete some files in a directory, but I do not know their > names...just ending extension... > > I have tried: > > One way: > > unlink <*.dat>; > unlink <*.p1>; > > Another wa

Re: executing programs in windows using system

2002-07-15 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > I have a dual processor windows NT machine. I need to execute a .exe > file from within my perl script but I need to have two copies of this > .exe file running simultaneously. I can do this by starting two > command prompt windows and typing the command but how can I acc

Re: capture out put from piped process

2002-07-15 Thread Jenda Krynicky
From: "Jon Howe" <[EMAIL PROTECTED]> > How do I capture the output from sendmail running under the -v switch > back to my programme. > > The line I am using is - > > open (MAIL, "|/usr/lib/sendmail -oi -t -v") or die "cant fork proc to > mail\n"; The easier way is to pipe it into a temporary fi

RE: deleting files

2002-07-15 Thread Michael Pastore
Got it working :) Thanks to Mike, Nikola and Janek... Have a wonderful day!!! Mike -Original Message- From: Mike(mickalo)Blezien [mailto:[EMAIL PROTECTED]] Sent: Monday, July 15, 2002 9:04 AM To: Michael Pastore Cc: [EMAIL PROTECTED] Subject: Re: deleting files Hi Michael, One

our %hash problem when require

2002-07-15 Thread Connie Chan
Some days ago, I've interested in the using of 'our' var, however, I do have some problem on using this with require. ### Lib 1 ### use strict; our %abc; $abc{a} = 1; $abc{b} = 2; ### EOF Lib 1 ### ### Lib 2 ### use strict; our $a = "ME"; ### EOF Lib 2 ### ### Script 1 ### use strict; eval

Re: overflow

2002-07-15 Thread Paul Johnson
On Mon, Jul 15, 2002 at 02:25:43PM +0300, Kliment Ognianov wrote: > Hi all > Maybe the question is quite stupid but ... :) > I've the following problem: > > A counter which counts something more exactly it comes as an > argument from other script. When it reaches the maximal 32-bit > i

Re: capture out put from piped process

2002-07-15 Thread drieux
On Monday, July 15, 2002, at 04:03 , Jon Howe wrote: > How do I capture the output from sendmail running under the -v switch back > to my programme. > > The line I am using is - > > open (MAIL, "|/usr/lib/sendmail -oi -t -v") or die "cant fork proc to > mail\n"; if you really want to 'catch' th

Re: script too slow?

2002-07-15 Thread John W. Krahn
Janek Schleicher wrote: > > John W. Krahn wrote at Sun, 14 Jul 2002 13:45:19 +0200: > > > > my @tokens = split /({\\[^\s}{]+|\\[^\s\\}]+|\\[\\}]|})/, $line; > > ^^ ^^ ^^ > > Perhaps we can simplify even this regex: > > my @tokens = split / ( \\ (?: [^\s{}]

Re: How to use one sub in a perl package?

2002-07-15 Thread drieux
On Sunday, July 14, 2002, at 08:03 , Daniel Gardner wrote: > Drieux wrote: [..] >> this sounds way strange... >> >> could you provide us with illustrative code here. > > I presume what the OP meant was that the module has an import() subroutine > which perhaps messes about with namespaces and fai

Re: Pb with deleting lines inside a file...

2002-07-15 Thread Janek Schleicher
Jean-Luc Beaudet wrote at Mon, 15 Jul 2002 12:17:57 +0200: > So my question is : HOW CAN I DELETE LINES IN A FILE ? > Read all lines and write only the lines you don't want to delete. Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

  1   2   >