Re: Open() and glob EXPR

2007-04-26 Thread John W. Krahn
Somu wrote: > I'm not certain about what EXPR is.. EXPR is any valid Perl expression. > How do i use glob? perldoc -f glob perldoc File::Glob > My next question is regarding opening pipes. I tried the following: > open ( FH , " notepad " ); > print FH 'hello' ; | is the pipe character so somet

Re: Open() and glob EXPR

2007-04-26 Thread Jeff Pang
open FH,">","notepad" or die $!; # create a new file open FH,">>","notepad" or die $!; # append to a file,if not exists,then create one see "perldoc -f open". 2007/4/27, Somu <[EMAIL PROTECTED]>: I'm not certain about what EXPR is.. How do i use glob? My next question is regarding opening pi

Open() and glob EXPR

2007-04-26 Thread Somu
I'm not certain about what EXPR is.. How do i use glob? My next question is regarding opening pipes. I tried the following: open ( FH , " notepad " ); print FH 'hello' ; But its only opening the notepad application, and nothing shows up on the notepad.. -- To unsubscribe, e-mail: [EMAIL PROTECT

Re: Math::BigFloat

2007-04-26 Thread Somu
Thanks. I got that corrected. Actually, in my code, $n wasnt a Math::BigFloat OBJECT. On 4/25/07, Rob Dixon <[EMAIL PROTECTED]> wrote: Somu wrote: > On 4/25/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: >> >> On 4/24/07, Somu <[EMAIL PROTECTED]> wrote: >>> >>> I'm unable to compare numbers using th

Re: Regexp

2007-04-26 Thread Somu
$q contains decoded msgs using MIME::Base64, and is any random word from a dictionary of 45000 words. On 4/26/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: Somu schreef: > why wont the following work? > > $$q = shift; print length($$q), " "; $$p = "pass"; > if ( $$q =~ m/$$p/i ) { print 'match' }

Re: improving my code: array of references

2007-04-26 Thread Rob Dixon
Pierre Mariani wrote: Hello everyone, I have a 'modify_variable' function that, well, modifies a variable. I want to run it on several variables. I have the following code that: - builds an array of references on the variables, - calls the function on the content of the reference, - set the co

Re: improving my code: array of references

2007-04-26 Thread Matthew J. Avitable
Hi Pierre, my @tmp = ( $var1, $var2, $var3 ); @tmp = map modify_variable, @tmp; which is better Conway (in Perl Best Practices) prefers the block form of map, since in his opinion, it's more readable. So you could rewrite it as: my @tmp = ( $var1, $var2, $var3 ); @tmp = map { modify_variab

Re: How can I respond to Net::FTP timeouts?

2007-04-26 Thread Tom Phoenix
On 4/26/07, charlie farinella <[EMAIL PROTECTED]> wrote: I have a script which uses Net::FTP to upload a backup file each night. It sends me an email each night if it succeeds and a different email if any of the methods fail. This all works, but sometimes the ftp connection times out and my scr

Re: improving my code: array of references

2007-04-26 Thread Paul Johnson
On Thu, Apr 26, 2007 at 03:26:02PM -0700, Pierre Mariani wrote: > anyone know how to create an array of references? my @a = \($a, $b, $c); -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ht

Re: improving my code: array of references

2007-04-26 Thread Pierre Mariani
> # $var1, $var2 and $var3 are set previously > > > for ( \$var1, > >\$var2, > >\$var3, > >) > > > > { > >${$_} = modify_variable ( ${$_} ); > > } > > > > Questions: > > - How do I improve my array definition? > > - How to I call the modify_

Re: Passing Hashes to a Sub

2007-04-26 Thread Tom Phoenix
On 4/26/07, yitzle <[EMAIL PROTECTED]> wrote: sub parseHtmlData($@) { my $hRef = shift; my %dHash = %$hRef; You've just made %dHash a copy of the data in the hash referred to by $hRef. You can do all you want with the copy, but it won't change the original hash. One solution would be

Re: improving my code: array of references

2007-04-26 Thread Rodrick Brown
Perfect canidate for Map. On 4/26/07, Pierre Mariani <[EMAIL PROTECTED]> wrote: Hello everyone, I have a 'modify_variable' function that, well, modifies a variable. I want to run it on several variables. I have the following code that: - builds an array of references on the variables, - calls

Passing Hashes to a Sub

2007-04-26 Thread yitzle
Something's not working... and I'm not sure where. I'm modifying working code and trying to make the hash non-global. If %dHash is global, it all works perfectly well. But when I try to pass it around... the writeHashToFile makes a 0 byte file. I would appreciate if you could check if I'm passin

improving my code: array of references

2007-04-26 Thread Pierre Mariani
Hello everyone, I have a 'modify_variable' function that, well, modifies a variable. I want to run it on several variables. I have the following code that: - builds an array of references on the variables, - calls the function on the content of the reference, - set the content of the reference t

Re: Keeping a process alive..

2007-04-26 Thread Tom Phoenix
On 4/26/07, Steve Pittman <[EMAIL PROTECTED]> wrote: I want to spawn a kornshell script Well, nobody's perfect. - track the PID - and restart the script if the PID is destroyed. Can anyone point me to a Perl reference for this? Do you really need to track the PID? while (1) { # resta

Keeping a process alive..

2007-04-26 Thread Steve Pittman
All, I want to spawn a kornshell script - track the PID - and restart the script if the PID is destroyed. Can anyone point me to a Perl reference for this? Thanks, Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

How can I respond to Net::FTP timeouts?

2007-04-26 Thread charlie farinella
I have a script which uses Net::FTP to upload a backup file each night. It sends me an email each night if it succeeds and a different email if any of the methods fail. This all works, but sometimes the ftp connection times out and my script hangs without sending anything. I don't know how

Re: cat (.sh) in Perl

2007-04-26 Thread Paul Johnson
On Thu, Apr 26, 2007 at 01:38:02AM +0100, Seanie wrote: > As a general rule, if your script contains 'system()' anywhere in it, you've > done it wrong. I think this is a little strong. Or a little general. Or something. Sometimes a calling system() is exactly the right thing to do. Sometimes

Re: Switching io redirection between display and file

2007-04-26 Thread Mumia W.
On 04/26/2007 07:05 AM, Nath, Alok (STSD) wrote: Hi , Can somebody help me out ? I wanted to switch io redirection between log file and standard display device.Basically sometimes I want to print into a log file and other time to the display device. [...] "perldoc -f open"

Re: XML::Writer creates a file but fails to be recognized

2007-04-26 Thread Rob Dixon
Dave Adams wrote: When generating a file with XML::Writer the script certainly builds the file but when I go to test for it, it fails. Does anyone have a reason why? How do I create a file that I can use in the rest of my script? use XML::Writer; use IO::File; my $output = new IO::File(">tes

XML::Writer creates a file but fails to be recognized

2007-04-26 Thread Dave Adams
When generating a file with XML::Writer the script certainly builds the file but when I go to test for it, it fails. Does anyone have a reason why? How do I create a file that I can use in the rest of my script? use XML::Writer; use IO::File; my $output = new IO::File(">test.xml"); my $writer =

Re: Test of scripts with Test::More

2007-04-26 Thread Ken Foskey
On Tue, 2007-04-24 at 14:44 -0400, [EMAIL PROTECTED] wrote: > Hi, > > Recently i wrote a perl module that includes package and a script. > As part of the module sanity tests, I would like to run the script and verify > a success. > For that, I am using Test::More and Test::Simple. > Is there any

Re: Perl error

2007-04-26 Thread Ken Foskey
On Wed, 2007-04-25 at 10:20 -0500, Kevin Viel wrote: >Thanks. I have been using this program without problem for a while, > I'd like to say over a year, but I am not sure. > >So, could it be that somehow the environment path variable relating > to perl had been changed? Otherwise, I c

Re: File::Basename issues

2007-04-26 Thread Ken Foskey
On Wed, 2007-04-25 at 17:15 -0700, Nishi wrote: > Hi: > > The File::Basename from 5.8.0 doesnot work in Perl 5.8.2 or Perl 5.8.7. Is > there any particular reason. Are yhou using activestate or cygwin perl. cygwin will do that because the filename you provided is not a cygwin filename. cygpath

Re: Switching io redirection between display and file

2007-04-26 Thread Jeff Pang
2007/4/26, Nath, Alok (STSD) <[EMAIL PROTECTED]>: Hi , Can somebody help me out ? I wanted to switch io redirection between log file and standard display device.Basically sometimes I want to print into a log file and other time to the display device. To redire

Switching io redirection between display and file

2007-04-26 Thread Nath, Alok (STSD)
Hi , Can somebody help me out ? I wanted to switch io redirection between log file and standard display device.Basically sometimes I want to print into a log file and other time to the display device. To redirect I am using this open (STDOUT, ">>

Re: Regexp

2007-04-26 Thread Dr.Ruud
Somu schreef: > why wont the following work? > > $q = shift; print length($q), "\n"; > $p = "pass"; > if ( $q =~ m/$p/i ) { print 'match' } > > But it works on changing the $q and $p places.. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For a

Re: RegEx Substitution + Arrays

2007-04-26 Thread Dr.Ruud
yitzle schreef: > What's the best way to apply a RegEx to an array? For loop? > @arr = qw/dc2ds reew12dsfa df2fdw/; > s/$find/$replace/ for(@arr); Consider: s/\Q$find/$replace/ for(@arr); -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

Re: basename equivalent?

2007-04-26 Thread Xavier Noria
On Apr 26, 2007, at 2:34 AM, Nishi wrote: What is the equivalent of basename? Ie if I dont want to use basename package to get the filename off a path, what reg expr can i use in perl? File::Basename is a standard module, why you don't want to use it? -- fxn -- To unsubscribe, e-mail: [