Re: exit perl script and cd in bash?

2004-01-19 Thread John W. Krahn
Kenton Brede wrote: > > I've been searching the archives and google for an answer. I suspect it > can't be done but thought I'd ask. > > What I'm trying to do is create a tool such as "cdargs", in perl, to > simplify moving between directories on the command line. > > The problem I'm having of

String manipulation

2004-01-19 Thread Jerry Preston
Hi! I am trying to figure out a simple, Perl way to break down any sting similar to the following: $s0 = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, 26,27,28,29"; Or in any numeric order. The string cannot be longer than 55 characters and end with ",". Ex: $s

Re: Why isn't perl used more in business and industry

2004-01-19 Thread Gabor Urban
Hi, I might know something for an answer. Though Perl is really good and fantastic, flexibole, etc. it has the bad reputation being hard to read. An average manager wants his or her stuff to be clean and neat. Seeing a tricky Perl code with regexp stuff is rather alarming. On the other hand Pytho

Re: String manipulation

2004-01-19 Thread Owen Cook
On Mon, 19 Jan 2004, Jerry Preston wrote: > I am trying to figure out a simple, Perl way to break down any sting similar > to the following: > > $s0 = > "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, > 26,27,28,29"; > > Or in any numeric order. The string cannot b

RE: Client system variables

2004-01-19 Thread Igor Idrisov
Igor Idrisov wrote: >> Hi! >> >> I'd like to get some system variables via web pages from CLIENT machines. >> Does anyone know any script that would do? >> >> Thank you!. >> >Can you be more descriptive? What are system variables, to you? How do >you mean "web pages from CLIENT machines", ge

Regarding unless in Perl

2004-01-19 Thread Mallik
Dear Friends, I have the following code unless(-d $dir) { unless(mkdir $dir) { print "Error\n"; } } Can I rewrite the above code in the following way unless (-d $dir | mkdir $dir) { print "Error\n"; } Thanks in advance, Mallik. -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Regarding unless in Perl

2004-01-19 Thread Gary Stainburn
On Monday 19 Jan 2004 10:12 am, Mallik wrote: > Dear Friends, > > I have the following code > > unless(-d $dir) > { >unless(mkdir $dir) >{ > print "Error\n"; >} > } > > Can I rewrite the above code in the following way > > unless (-d $dir | mkdir $dir) > { >print "Error\n"; >

Re: Regarding unless in Perl

2004-01-19 Thread Owen Cook
On Mon, 19 Jan 2004, Mallik wrote: > I have the following code > > unless(-d $dir) > { >unless(mkdir $dir) >{ > print "Error\n"; >} > } > > Can I rewrite the above code in the following way > > unless (-d $dir | mkdir $dir) > { >print "Error\n"; > } > Well that works fo

Passing Hash table to function?

2004-01-19 Thread Tushar Gokhale
I have a hash table which contains values like my %enumerations = ( #mystat mode 'edcf' => '1', 'hcf' => '2', #admin state 'disable' => '0', 'enable' => '1', ); I have created a library of common functions and the a

variable FORMAT in printf?

2004-01-19 Thread Bryan Harris
Hi, I've tried everything I can think of, but I feel like a 6th grader trying to solve a 7th grade math problem: I'm trying to build a "pretty-fier" for any tab-delimited text file (basically space-pad the columns so the decimals line up). I search through the columns finding the longest field

Relative path

2004-01-19 Thread Jan Eden
Hi, I wrote some scripts using File::Find's find function like this find (\&process, $path) I get $path either from the command line or from a default string. Now how can I enable my scripts to deal with relative pathnames? Right now, the script complains not being able to process (open etc.)

Re: variable FORMAT in printf?

2004-01-19 Thread Tassilo von Parseval
On Sun, Jan 18, 2004 at 09:53:56PM -0700 Bryan Harris wrote: > I've tried everything I can think of, but I feel like a 6th grader trying to > solve a 7th grade math problem: > > I'm trying to build a "pretty-fier" for any tab-delimited text file > (basically space-pad the columns so the decimals

name of calling function

2004-01-19 Thread Gary Stainburn
Hi folks, In the back of my mind I seem to think that you can find out where a function was called from. What I'm after is: my %_DEBUG={'new'=>1,'load_file'=>0}; sub debug { my $caller= return (defined $_DEBUG{$caller} ? $_DEBUG{$caller} : 0; } sub new { # create new track ob

Re: name of calling function

2004-01-19 Thread Gary Stainburn
On Monday 19 Jan 2004 1:09 pm, Gary Stainburn wrote: > Hi folks, > > In the back of my mind I seem to think that you can find out where a > function was called from. What I'm after is: > > my %_DEBUG={'new'=>1,'load_file'=>0}; > > sub debug { > my $caller= > return (defined $_DEBUG

RE: name of calling function

2004-01-19 Thread Hanson, Rob
> my $caller= You are so close. my $caller = caller; Look at "perldoc -f caller" for more info on the different ways to use it. Please note that sometime the info you get from caller isn't the real caller. If you call your debug() function right before a return statement it is pos

RE: String manipulation

2004-01-19 Thread Bob Showalter
Jerry Preston wrote: > Hi! > > I am trying to figure out a simple, Perl way to break down any sting > similar to the following: > > $s0 = > "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, > 26,27,28,29"; > > Or in any numeric order. The string cannot be longer than

RE: Client system variables

2004-01-19 Thread Tim Johnson
Maybe it would help if we knew why you wanted to do this. I'm not sure I get the whole picture of what you are trying to do. You can get system (and user) environment variables via a perl program using a module like Win32::AdminMisc or even through the registry, but that would require that t

parse email

2004-01-19 Thread Paul Kraus
Is there anyway I can get outlook to run a perl script whenever mail from a particular user arrives? I have Hylafax log data email to me. It would be great if I could just get outlook to run the app for me to generate the reports instead of having to copy the message into a text file and then run

Re: exit perl script and cd in bash?

2004-01-19 Thread Dan Anderson
On Mon, 2004-01-19 at 02:05, John W. Krahn wrote: > Kenton Brede wrote: > > > > I've been searching the archives and google for an answer. I suspect it > > can't be done but thought I'd ask. > > > > What I'm trying to do is create a tool such as "cdargs", in perl, to > > simplify moving between

OT: Re: parse email

2004-01-19 Thread Dan Anderson
On Mon, 2004-01-19 at 09:50, Paul Kraus wrote: > Is there anyway I can get outlook to run a perl script whenever mail from a > particular user arrives? Evolution (Sorry, Linux only) and (I believe) Mozilla support shell commands on e-mails. Switching would also block infection from a number of vi

Re: parse email

2004-01-19 Thread drowl
> Is there anyway I can get outlook to run a perl script whenever mail > from a particular user arrives? > > I have Hylafax log data email to me. It would be great if I could just > get outlook to run the app for me to generate the reports instead of > having to copy the message into a text file a

Re: Passing Hash table to function?

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 5:26 AM, Tushar Gokhale wrote: I have a hash table which contains values like my %enumerations = ( #mystat mode 'edcf' => '1', 'hcf' => '2', #admin state 'disable' => '0', 'enable' => '1', ); I

Re: Relative path

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 6:31 AM, Jan Eden wrote: Hi, I wrote some scripts using File::Find's find function like this find (\&process, $path) I get $path either from the command line or from a default string. Now how can I enable my scripts to deal with relative pathnames? Right now, the script co

Re: Relative path

2004-01-19 Thread Jan Eden
James Edward Gray II wrote: >On Jan 19, 2004, at 6:31 AM, Jan Eden wrote: > >>Hi, >> >>I wrote some scripts using File::Find's find function like this >> >>find (\&process, $path) >> >>I get $path either from the command line or from a default string. >>Now how can I enable my scripts to deal wit

RE: Re: parse email

2004-01-19 Thread Paul Kraus
> Evolution (Sorry, Linux only) and (I believe) Mozilla support shell > commands on e-mails. > > Switching would also block infection from a number of viruses Outlook > always seems to be plagued with. Agreed. I am Linux man myself but here at work the entire office is connected via outlook for a

RE: Re: parse email

2004-01-19 Thread Dan Anderson
On Mon, 2004-01-19 at 11:00, Paul Kraus wrote: > > Evolution (Sorry, Linux only) and (I believe) Mozilla support shell > > commands on e-mails. > > > > Switching would also block infection from a number of viruses Outlook > > always seems to be plagued with. > > Agreed. I am Linux man myself but

RE: Re: parse email

2004-01-19 Thread Paul Kraus
Where not actually using exchange. But we do take advantage of calendar assignments that are emailed from outlook to other outlook. Be able to on a click update meeting and appointments. To my understanding you can not do this with evolution unless you are running exchange. Paul Kraus --

Re: Relative path

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 9:53 AM, Jan Eden wrote: I always hesitate to use perldoc, since the system is so crippled on my machine. 'perldoc perldoc' does not work, and the whole perlfaq is missing (on OS 10.3). You probably know this, but just to be sure, this is not normal. 'perldoc' works beauti

Weekly list FAQ posting

2004-01-19 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address):

Re: Relative path

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 10:50 AM, Jan Eden wrote: I imagine you could fix it by upgrading/reinstalling Perl, if you're interested. Can I reinstall Perl (just Perl) from the OS X CDs? Unfortunately, I don't believe you can. Sorry. James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: Why isn't perl used more in business and industry

2004-01-19 Thread drieux
On Jan 18, 2004, at 11:58 PM, Gabor Urban wrote: I might know something for an answer. Though Perl is really good and fantastic, flexibole, etc. it has the bad reputation being hard to read. An average manager wants his or her stuff to be clean and neat. Seeing a tricky Perl code with regexp stuff

Re: Relative path

2004-01-19 Thread Daniel Staal
--As off Monday, January 19, 2004 5:50 PM +0100, Jan Eden is alleged to have said: I imagine you could fix it by upgrading/reinstalling Perl, if you're interested. Can I reinstall Perl (just Perl) from the OS X CDs? --As for the rest, it is mine. Yes, if you get the program Pacifist. It can ex

Re: Regarding unless in Perl

2004-01-19 Thread John W. Krahn
Mallik wrote: > > Dear Friends, Hello, > I have the following code > > unless(-d $dir) > { >unless(mkdir $dir) >{ > print "Error\n"; >} > } > > Can I rewrite the above code in the following way > > unless (-d $dir | mkdir $dir) > { >print "Error\n"; > } You don't real

Saying an item is empty

2004-01-19 Thread Trina Espinoza
I would like to know how I would say if $item equals $tempitem OR if $item is empty(the variable is a placeholder that has nothing in it), execute command. Are either of these saying the above statement because I don't seem to be getting the expected results. If ($item =~ /^(\D+)(\d+)/ {)

Re: variable FORMAT in printf?

2004-01-19 Thread John W. Krahn
Bryan Harris wrote: > > Hi, Hello, > I've tried everything I can think of, but I feel like a 6th grader trying to > solve a 7th grade math problem: > > I'm trying to build a "pretty-fier" for any tab-delimited text file > (basically space-pad the columns so the decimals line up). I search thro

Re: Relative path

2004-01-19 Thread Jan Eden
Daniel Staal wrote: >One other thing, perldoc is actually a part of the Developer Tools >(eg, XCode) install, not the normal OS X install. If you haven't >installed that then that could be the problem. (Perl itself is part >of the base system, but you only need the docs if you are a >develo

Re: Saying an item is empty

2004-01-19 Thread Steve Grazzini
Trina Espinoza wrote: I would like to know how I would say if $item equals $tempitem OR if $item is empty(the variable is a placeholder that has nothing in it), execute command. Usually "empty" means "undefined", and if that's what you mean, you could check like this: if ((not defined $item)

Re: Saying an item is empty

2004-01-19 Thread John W. Krahn
Trina Espinoza wrote: > > I would like to know how I would say if $item equals $tempitem OR if $item is > empty(the variable is a placeholder that has nothing in it), execute command. By empty do you mean the null string "": if ( $item eq $tempitem or $item eq '' ) { Or do you mean the value

RE: threads in perl

2004-01-19 Thread david
Igor Ryaboy wrote: > Hi > I want to kill a specific thread and thread->list to be updated (Like > thread->join but without waiting). Igor > instead of killing a thread, why not just let the thread die when you need to kill it? take a look at Thread::Exit and Thread::Suspend, they let you kill

RE: name of calling function

2004-01-19 Thread david
Rob Hanson wrote: > If you call your debug() function right before a return statement > it is possible that optimizations by the Perl compiler can optimize the > calling info away. can you give an example to demonstrate this affect? david -- sub'_{print"@_ ";* \ = * __ ,\ & \} sub'__{print"@_

Re: Saying an item is empty

2004-01-19 Thread Dan Anderson
scalar (@array) can be used to find the number of elements in @array. @{$foo} can be used to work with the array represented by the array reference $foo you can combine the two for scalar(@{$foo}) Also remember hashes are even sized arrays. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: double-log-tail

2004-01-19 Thread Wiggins d'Anconia
Joel Newkirk wrote: I'm interested in tailing two logs (qmail) simultaneously, and interleaving the data in something approaching chronological sequence, as well as dealing with logfile rotation gracefully. Any suggestions? Check out File::Tail on CPAN, particularly the section on 'select' and th

Re: Why isn't perl used more in business and industry

2004-01-19 Thread Wiggins d'Anconia
Lost my other thread sorry this is listed as a new topic. Going through some of my older e-mails finally from vacation, and there was an article from 01/15/2004 that pertains to the conversation or could... http://use.perl.org/article.pl?sid=04/01/15/1942236&tid= (news posting) http://www.perl.c

Adding a second email address to form recipient

2004-01-19 Thread SanderL
I have a simple form that I have been using for a while that I now need to add a second recipient to. My current code is a follows: #!/usr/bin/perl use CGI param; $p = CGI::new(); $mailProgram = '/var/qmail/bin/qmail-inject'; # Email id to send the email to $emailId = '[

How to send results to more than one recipient

2004-01-19 Thread Sander
I have a simple form that I have been using for a while, but now I need to send the data to two email addresses. What is the simplest way to achieve this? I have tried various combinations and can't seem to figure it out. $emailId = '[EMAIL PROTECTED]' '[EMAIL PROTECTED]'; ??? Here is my code ri

looping through (a lot of) files

2004-01-19 Thread wolf blaum
Hi there, I do have one type A file, that holds about 25.000 A-ids, one per line. Furher I have 500 type B files in a dir that hold 10-500 B-ids each, one per line. All files are -T Now i want to generate 500 type C files, corrosponding to the b files: each B-id, that occours in a B-type file A

Re: How to send results to more than one recipient

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 3:23 PM, Sander wrote: I have a simple form that I have been using for a while, but now I need to send the data to two email addresses. What is the simplest way to achieve this? I have tried various combinations and can't seem to figure it out. $emailId = '[EMAIL PROTECTED

Re: looping through (a lot of) files

2004-01-19 Thread James Edward Gray II
On Jan 19, 2004, at 4:33 PM, wolf blaum wrote: Hi there, Hello. I do have one type A file, that holds about 25.000 A-ids, one per line. Furher I have 500 type B files in a dir that hold 10-500 B-ids each, one per line. All files are -T Now i want to generate 500 type C files, corrosponding to th

Search and replace pattern in a file

2004-01-19 Thread Perl
Hi, here is the situation i have : i have a long list of files in a directory. i have to search and replace a particular pattern in each file. since a file cannot be read and written to at the same time, what's the best way of doing the search and replace ? i take this approach of doing the sear

RE: Search and replace pattern in a file

2004-01-19 Thread Hanson, Rob
I think you will like this, it does exactly whay you described... perl -pi.bak 's|ReplaceThis|WithThis|' * This does everything you want, AND makes a backup of each file. You can only perform a substitution on a single line though (AFAIK). See perldoc perlrun for all of the details. WARNING: M

RE: Search and replace pattern in a file

2004-01-19 Thread Hanson, Rob
Sorry, my bad. Forgot the -e switch... perl -pi.bak -e 's|ReplaceThis|WithThis|' * Rob -Original Message- From: Hanson, Rob Sent: Monday, January 19, 2004 8:04 PM To: 'Perl'; [EMAIL PROTECTED] Subject: RE: Search and replace pattern in a file I think you will like this, it does exact

passing arguments to functions

2004-01-19 Thread jassismara
Hi all Problem: I want to send 2 arguments to a subroutine in the form of arrays and want to use their result which is also in the form of an array. Explanation: suppose i have 2 arrays @a=`/bin/cat /some/file` ; # A file that has a list of users @b=`/bin/cat /another/file` ; # Another

RE: passing arguments to functions

2004-01-19 Thread Hanson, Rob
> I want to send 2 arguments to a subroutine > in the form of arrays I think what you want to use are references. Check out "perldoc perlreftut". # WARNING: untested code ahead my @a = `/bin/cat /some/file`; my @b = `/bin/cat /another/file`; my @result = addArray([EMAIL PROTECTED], [EMAIL PROTEC

for loop not ending

2004-01-19 Thread Damian Scott
Ok. Here's my situation. I am modifying a Perl script that was created some time ago and am learning Perl on kind of a "trial by fire" basis (with a couple of good books). The problem was first brought to my attention that we still had old log files greater than 60 old. The gziplog Perl scri

RE: for loop not ending

2004-01-19 Thread Hanson, Rob
> for ($day=$keeplogs+1;$day>$keeplogs;$day++) { Hmmm... lets assume $keeplogs = 60 (right?). The problem is that $day is always going to e greater than $keeplogs, because you initialized day that way. So yes, you need to set an upper bounds. Maybe this. my $max_days_old = 120; # loops from 6

Re: variable FORMAT in printf?

2004-01-19 Thread Bryan Harris
>> I've tried everything I can think of, but I feel like a 6th grader trying to >> solve a 7th grade math problem: >> >> I'm trying to build a "pretty-fier" for any tab-delimited text file >> (basically space-pad the columns so the decimals line up). I search through >> the columns finding th

Terminating script if file does not exist

2004-01-19 Thread perlwannabe
Basically the script runs and looks for a file in a certain directory. If the file is there, the script continues to run and process the file, but if the file is not there the script should just exit. Any ideas on how to do this? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

Re: Terminating script if file does not exist

2004-01-19 Thread Kenton Brede
On Mon, Jan 19, 2004 at 11:25:02PM -0500, perlwannabe ([EMAIL PROTECTED]) wrote: > Basically the script runs and looks for a file in a certain directory. If > the file is there, the script continues to run and process the file, but > if the file is not there the script should just exit. > > Any i

RE: Terminating script if file does not exist

2004-01-19 Thread Tim Johnson
How about: # use strict; use warnings; open(INFILE,"the_file") || die "Could not open \"the_file\" for reading!\n"; #...do something with the file # -Original Message- From: perlwannabe [mailto:[EMAIL PROTECTED]

RE: threads in perl

2004-01-19 Thread Igor Ryaboy
Hi, Thanks for your tips, Where can I get those modules? Igor -Original Message- From: david [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 9:15 PM To: [EMAIL PROTECTED] Subject: RE: threads in perl Igor Ryaboy wrote: > Hi > I want to kill a specific thread and thread->list to