Re: Is this possible? (file handles)

2004-04-01 Thread WC -Sx- Jones
Jeff Westman wrote: Venugopal P <[EMAIL PROTECTED]> wrote: Once you close the file, memory for the file handle will be deallocated. You can unlink file using the original file name. unlink ("abc"); This doesn't answer my question. I wanted to know if it is possible to remove a file using the F

Re: directory and file operations

2004-04-01 Thread WC -Sx- Jones
MuthuKumar wrote: print "Enter a path name: "; my $path=; chdir($path); chdir never "stays" in the directory... Proof: print "Enter a path name: "; my $path=; chdir($path); print `pwd`; You want - perldoc -f opendir -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

RE: Is this possible? (file handles)

2004-04-01 Thread Jeff Westman
Venugopal P <[EMAIL PROTECTED]> wrote: > Once you close the file, memory for the file handle will be > deallocated. > You can unlink file using the original file name. > unlink ("abc"); This doesn't answer my question. I wanted to know if it is possible to remove a file using the FH name, not th

Re: How to determine if STDIN has piped data?

2004-04-01 Thread Bryan Harris
> Alternatively, you can use the '-t' operator: > > exit 0 if -t STDIN I've been waiting for this for a LONG time, thanks Smoot. >>> >>> No problem. It took me a while to find the correct operator as well. >>> >>> Please keep in mind that doing this breaks the de facto

Re: Is this possible? (file handles)

2004-04-01 Thread Smoot Carl-Mitchell
On Fri, 2 Apr 2004 10:55:07 +0530 "Venugopal P" <[EMAIL PROTECTED]> wrote: > Once you close the file, memory for the file handle will be > deallocated. You can unlink file using the original file name. > unlink ("abc"); On Unix systems, you may unlink a file after opening it. The directory entry

directory and file operations

2004-04-01 Thread MuthuKumar
Hi, I want to open all (.txt,.html,.js files) files in a particular directory and replace a text in all that files. What I done so far was a script to replace text in all files in the current directory. What I want was," When I run the script,it should ask for the path of a particular directory

RE: Is this possible? (file handles)

2004-04-01 Thread Venugopal P
Once you close the file, memory for the file handle will be deallocated. You can unlink file using the original file name. unlink ("abc"); -Original Message- From: Jeff Westman [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 2:02 AM To: perl_help Subject: Is this possible? (file h

Re: using strict

2004-04-01 Thread Wiggins d'Anconia
[EMAIL PROTECTED] wrote: Does the following turn off strict for a vars? no strict "vars"; Could you also turn off strict for other things besides vars, refs and subs? Say for a subroutine (for example). Pragma are block/file scoped similar to a lexical. To answer your question below, yes you c

Re: Hash ref's of hash's

2004-04-01 Thread Wiggins d'Anconia
[EMAIL PROTECTED] wrote: Hi all, I am trying to setup a hash who's values are referance to hash's. Data structure should look like this hash 1: setting 1 setting 2 2: setting 1 setting 2 This does not look like a HoH, but a HoA. I

Re: HOWTO: File Renaming and Directory Recursion

2004-04-01 Thread Morbus Iff
>> while (@files) { > >Are you sure that's not: > > for (@files) { Yup, "for" is right. An error in my memory recall. -- Morbus Iff ( evil is my sour flavor ) Technical: http://www.oreillynet.com/pub/au/779 Culture: http://www.disobey.com/ and http://www.gamegrene.com/ icq: 2927491 / aim: aka

Re: Can anyone help

2004-04-01 Thread Wiggins d'Anconia
Doug Guilding wrote: I am trying to get perl scripts working on a win2k server - does anyone have any good ideas. My ISP say that they "cannot support the use of web scripts" However they have told me the path to perl and sendmail. /usr/bin/perl /usr/sbin/sendmail The problem is I can't get a

Re: HOWTO: File Renaming and Directory Recursion

2004-04-01 Thread Randy W. Sims
On 4/1/2004 7:05 PM, Morbus Iff wrote: # and here is that subroutine. it's nearly exactly # the same as our previous code, only this time, we # move into the directory that contains a file to # be renamed. this is actually a quick hack because # I knew this wouldn't be production-code: a more

Re: HOWTO: File Renaming and Directory Recursion

2004-04-01 Thread Paul Johnson
On Thu, Apr 01, 2004 at 07:05:51PM -0500, Morbus Iff wrote: > Earlier this morning, a friend of mine asked me for a script that would > "given a list of files, replace underscores with spaces", to take this: > > Artist_Name-Track_Name.mp3 > > and rename it to this: > > Artist Name-Track Nam

Re: Strings with extended characters

2004-04-01 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: Is there a simple way to reject any string that has extended characters in it? In other words, only accept the 88 (I think it's 88) regular keyboard characters and numbers. I can't find a simple way to do this. Does this help? if($string !~ m/^\w+$/) { die "I hate ex

HOWTO: File Renaming and Directory Recursion

2004-04-01 Thread Morbus Iff
Earlier this morning, a friend of mine asked me for a script that would "given a list of files, replace underscores with spaces", to take this: Artist_Name-Track_Name.mp3 and rename it to this: Artist Name-Track Name.mp3 The script was mindlessly simple, and I felt it would be a good HOWTO

Re: A long time helper needs help

2004-04-01 Thread William.Ampeh
Wow! Thanks a lot. I am going to try to decipher your code and hope you will not mind me asking questions later. >>It's a bit hard to give good suggestions if I do not understand the data. Are all the data yearly like the stuff in page6.prn? The data are bunch of report files, the format

RE: directory operations

2004-04-01 Thread Tim Johnson
If you did want to filter based on a regular expression, you can always do it the long way: opendir(DIR,".") || die; my @file_list = readdir(DIR); foreach my $file(@file_list){ if(-f $file && ($file =~ /Place Regex Here/)){ #do something... } } You get the general idea. Al

Re: Check if another script running

2004-04-01 Thread Smoot Carl-Mitchell
On Thu, 01 Apr 2004 16:34:11 -0600 Mike Blezien <[EMAIL PROTECTED]> wrote: > that was my original plan, but I though there maybe a better way > others may use or suggest :) > > Appreciate the feedback, If you are running this on a Unix/Linux system check out perldoc -f flock. It enables advisory

Re: using strict

2004-04-01 Thread WilliamGunther
In a message dated 4/1/2004 5:03:40 PM Eastern Standard Time, [EMAIL PROTECTED] writes: People of the Perl, >from my understanding strict disallows soft references, ensures that all >variables are declared before usage and disallows barewords except for >subroutines. > >what is a soft referen

Check if another script running

2004-04-01 Thread Mike Blezien
Hello, I need to setup a cronjob to run a script every 2hrs, but if another particular script(executed via a standard web form), on the same machine, is being executed, I want the cron script "wait" or "sleep();" till the other script is finished. Is this possible to do and how is the best way to

Can anyone help

2004-04-01 Thread Doug Guilding
I am trying to get perl scripts working on a win2k server - does anyone have any good ideas. My ISP say that they "cannot support the use of web scripts" However they have told me the path to perl and sendmail. /usr/bin/perl /usr/sbin/sendmail The problem is I can't get anything to work. I've

Re: using strict

2004-04-01 Thread u235sentinel
Does the following turn off strict for a vars? no strict "vars"; Could you also turn off strict for other things besides vars, refs and subs? Say for a subroutine (for example). Just curious. I've run into situations where I've come across badly maintained code and would like to do this for

Timezone conversion

2004-04-01 Thread Distribution Lists
can someone give me ideas of how I could convert this date and time stamp that is in GMT to Central time ? 2004-04-01-19:15:15.525+00:00 Thanks -- -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: using strict

2004-04-01 Thread Randy W. Sims
On 4/1/2004 5:01 PM, [EMAIL PROTECTED] wrote: People of the Perl, from my understanding strict disallows soft references, ensures that all variables are declared before usage and disallows barewords except for subroutines. what is a soft reference? what is a bareword? why is strict disallowin

Hash ref's of hash's

2004-04-01 Thread mgoland
Hi all, I am trying to setup a hash who's values are referance to hash's. Data structure should look like this hash 1: setting 1 setting 2 2: setting 1 setting 2 I would think it can be accomplished with following code, but when

RE: Strings with extended characters

2004-04-01 Thread Jayakumar Rajagopal
Jim Please send two sample strings one that contains 'reject'able stuff, and other with those 88. That would clarify us better. Jay -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 9:58 AM To: [EMAIL PROTECTED] Subject: Strings with extend

Re: Strings with extended characters

2004-04-01 Thread Daniel Staal
--As of Thursday, April 1, 2004 9:58 AM -0500, [EMAIL PROTECTED] is alleged to have said: Is there a simple way to reject any string that has extended characters in it? In other words, only accept the 88 (I think it's 88) regular keyboard characters and numbers. I can't find a simple way to do

Re: Check if another script running

2004-04-01 Thread Randy W. Sims
On 4/1/2004 3:46 PM, Mike Blezien wrote: Hello, I need to setup a cronjob to run a script every 2hrs, but if another particular script(executed via a standard web form), on the same machine, is being executed, I want the cron script "wait" or "sleep();" till the other script is finished. Is th

RE: Check if another script running

2004-04-01 Thread Jayakumar Rajagopal
sorry.. I missed one thing.. This is the right condition line: ps -ef | grep $0 | grep -v $$ | grep -v grep | grep $0 -Original Message- From: Jayakumar Rajagopal Sent: Thursday, April 01, 2004 5:30 PM To: [EMAIL PROTECTED]; Perl List Subject: RE: Check if another script running I think

Re: using strict

2004-04-01 Thread Daniel Staal
--As of Thursday, April 1, 2004 5:01 PM -0500, [EMAIL PROTECTED] is alleged to have said: what is a soft reference? what is a bareword? why is strict disallowing a compile here When I comment out strict the syntax checks outs as ok!??? how do I display each element # with its corresponding

RE: help in find and replacing a string in a number of files

2004-04-01 Thread Charles K. Clarkson
prabu <[EMAIL PROTECTED]> wrote: : : i am new to perl.I am in a problem,So please help me to : get a solution : "I want to change texts in 172 files available at a directory : /pages(there are files also in a sub-directory),they all are : text files. : There are also some text fil

Re: Check if another script running

2004-04-01 Thread Mike Blezien
Hi Randy, that was my original plan, but I though there maybe a better way others may use or suggest :) Appreciate the feedback, Mike Randy W. Sims wrote: On 4/1/2004 3:46 PM, Mike Blezien wrote: Hello, I need to setup a cronjob to run a script every 2hrs, but if another particular script(e

RE: Check if another script running

2004-04-01 Thread Jayakumar Rajagopal
I think your question is more related to unix than perl. Try something like this in shell script : program=$0 while ps -ef | grep $0 | grep -v grep | grep $$ do sleep 10 done or in perl $program=$0; while ( `ps -ef | grep $0 | grep -v grep | grep $$` ) { sleep 10 ; } ** I d

Check if another script running

2004-04-01 Thread Mike Blezien
Hello, I need to setup a cronjob to run a script every 2hrs, but if another particular script(executed via a standard web form), on the same machine, is being executed, I want the cron script "wait" or "sleep();" till the other script is finished. Is this possible to do and how is the best way

RE: using strict

2004-04-01 Thread Guay Jean-Sébastien
Hello Derek, When using strict, the error message should point you to the line where the error is. It's usually pretty darn good at pointing the right line. In this case, I bet it's this one: >while ( defined($line = ) ) { There is no declaration of the $line variable. Try declaring it f

Need some guidance

2004-04-01 Thread Najamuddin, Junaid
Thanks in advance. Being a novice to Perl trying to write a perl script at my work in windows environment. I have couple of machines on Microsoft network load balancing (wlbs) And one url is being used to access those machines. Want to ping individual urls related to each machine on the cluster. A

using strict

2004-04-01 Thread DBSMITH
People of the Perl, from my understanding strict disallows soft references, ensures that all variables are declared before usage and disallows barewords except for subroutines. what is a soft reference? what is a bareword? why is strict disallowing a compile here When I comment out strict

Check if another script running

2004-04-01 Thread Mike Blezien
Hello, I need to setup a cronjob to run a script every 2hrs, but if another particular script(executed via a standard web form), on the same machine, is being executed, I want the cron script "wait" or "sleep();" till the other script is finished. Is this possible to do and how is the best way to

Strings with extended characters

2004-04-01 Thread Jimstone77
Is there a simple way to reject any string that has extended characters in it? In other words, only accept the 88 (I think it's 88) regular keyboard characters and numbers. I can't find a simple way to do this.

Re: directory operations

2004-04-01 Thread Randy W. Sims
MuthuKumar wrote: Hello All, I have a directory which contains several files.. like .txt .html .js files like that. I have to search a pattern in all files.. if it is available then replace it and else leave it out. I have made it for single file.. what i want is to implement for the full dire

Re: How Random is Random?

2004-04-01 Thread Phil Schaechter
> You will note that the documentation says "apparently random order." In > more recent versions of Perl (IIRC starting at 5.8.1) randomness was > added to hash keys for security reasons. In previous versions the order > of the hash keys was determined by the hash function used which appeared > r

help in find and replacing a string in a number of files

2004-04-01 Thread prabu
Hi, i am new to perl.I am in a problem,So please help me to get a solution "I want to change texts in 172 files available at a directory /pages(there are files also in a sub-directory),they all are text files. There are also some text files,which I no need to change.I want one single

Re: directory operations

2004-04-01 Thread Flemming Greve Skovengaard
MuthuKumar wrote: Hello All, I have a directory which contains several files.. like .txt .html .js files like that. I have to search a pattern in all files.. if it is available then replace it and else leave it out. I have made it for single file.. what i want is to implement for the full dire

Re: How to determine if STDIN has piped data?

2004-04-01 Thread Morten Liebach
On 2004-03-30 21:35:21 -0700, Bryan Harris wrote: > > > > On Mon, 29 Mar 2004 00:38:50 -0700 > > Bryan Harris <[EMAIL PROTECTED]> wrote: > > > >>> Alternatively, you can use the '-t' operator: > >>> > >>> exit 0 if -t STDIN > >> > >> > >> I've been waiting for this for a LONG time, thanks Smo

directory operations

2004-04-01 Thread MuthuKumar
Hello All, I have a directory which contains several files.. like .txt .html .js files like that. I have to search a pattern in all files.. if it is available then replace it and else leave it out. I have made it for single file.. what i want is to implement for the full directory.. my @file

Re: @ in a string

2004-04-01 Thread Randy W. Sims
John wrote: I realised that the @ cannot enter in a string without escape characters. Is that equivalent to " That's not quite true. Within double quotes, anything that looks like a variable is interpreted as a variable. So, 'print "@"' is perfectly fine. It does not look like a variable because

Re: How to determine if STDIN has piped data?

2004-04-01 Thread Robin Sheat
On Wed, Mar 31, 2004 at 11:58:58PM -0700, Bryan Harris wrote: > =) I was referring to a socket. I couldn't think of any place where I > might need to use one. As an example, I have a neural network system I made in Java. It accepts commands over a network socket. I then have a Perl program conne

@ in a string

2004-04-01 Thread John
I realised that the @ cannot enter in a string without escape characters. Is that equivalent to " Thanks John