Question on Arrays

2005-03-16 Thread Robert
@districts = qw/ elldev elldev2 icedev prodev /; $app = "M:\\Path\\app.exe "; foreach $dist ( @districts ) { print $app, $dist,"\n"; # modifying this to a system call like system( $app, $dist ); } I am going to change the print statement above with a system one so that $app will run with

build perl modules

2005-03-16 Thread Mahantesh Hongal
Hi, Can anybody let me know how to create our own modules in perl. Thanks in advance... Mahantesh V H -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Perl Analyzing Maillog

2005-03-16 Thread Nick Chettle
Hi All, I am trying to write a simple script that will analyze a Postfix maillog. The basic idea is that you give it an e-mail address and it will print all the relevant lines. In order to achieve this, you first need a message ID, you can then search for the id and bring all the relevant infor

RE: Question on Arrays

2005-03-16 Thread Moon, John
@districts = qw/ elldev elldev2 icedev prodev /; $app = "M:\\Path\\app.exe "; foreach $dist ( @districts ) { print $app, $dist,"\n"; # modifying this to a system call like system( $app, $dist ); } I am going to change the print statement above with a system one so that $app will run with

Re: build perl modules

2005-03-16 Thread Chris Devers
On Wed, 16 Mar 2005, Mahantesh Hongal wrote: > Can anybody let me know how to create our own modules in perl. Yes. (Hint, try Google, try introductory books (_Learning Perl_), try advanced books (_Object-Oriented Perl_), try examining other modules.) -- Chris Devers -- To unsubscribe, e-

RE: build perl modules

2005-03-16 Thread Moon, John
Hi, Can anybody let me know how to create our own modules in perl. Thanks in advance... Mahantesh V H The simple answer is: Create a file for the "sub" and save as a ".pm"... To include it in you main program... use lib "where/you/saved/the/sub"; use sub_you_saved; &sub_use_saved; That s

Re: build perl modules

2005-03-16 Thread Nicholas . Montpetit
Chris Devers <[EMAIL PROTECTED]> wrote on 03/16/2005 06:27:42 AM: > On Wed, 16 Mar 2005, Mahantesh Hongal wrote: > > > Can anybody let me know how to create our own modules in perl. > > Yes. > > (Hint, try Google, try introductory books (_Learning Perl_), try > advanced books (_Object-Oriented

instaling MySQL

2005-03-16 Thread Octavian Rasnita
Hi, Please tell me what could mean the following errors I get when trying to install DBD::mysql for MySQL 4.1.1 under Fedora Core 2. I am fighting for a day to install DBD::mysql, but without success. I have also tried to install it by downloading the tar ball and compiling, but with no luck. H

Re: build perl modules

2005-03-16 Thread Steve Bertrand
>>> Can anybody let me know how to create our own modules in perl. >>> >> >> Yes. >> >> >> (Hint, try Google, try introductory books (_Learning Perl_), try >> advanced books (_Object-Oriented Perl_), try examining other >> modules.) >> > > Another good book is _Learning Perl Objects, References an

Re: Perl Analyzing Maillog

2005-03-16 Thread mgoland
- Original Message - From: Nick Chettle <[EMAIL PROTECTED]> Date: Wednesday, March 16, 2005 7:02 am Subject: Perl Analyzing Maillog > Hi All, Hello, > > I am trying to write a simple script that will analyze a Postfix > maillog. The basic idea is that you give it an e-mail address and

RE: build perl modules

2005-03-16 Thread Charles K. Clarkson
Mahantesh Hongal wrote: : Can anybody let me know how to create our own modules in perl. What would you like to place inside the modules? You can limit yourself to just subs or you can add data, methods, and objects. What is your intended end use of this module? H

Re: Perl Analyzing Maillog

2005-03-16 Thread Nick Chettle
Hi, Thanks, that seems a far better way to do it. A few things though: I am not 100% sure what this line does. push @{ $msgids->{$1} }, $_; Is the @{} surrounding the hash used to make push work with a hash? Also, why do you need -> and can't just do $msgids{$1}, $_; ? I made a slight change to m

Re: Perl Analyzing Maillog

2005-03-16 Thread Zeus Odin
"Nick Chettle" <[EMAIL PROTECTED]> wrote in message ... > Hi All, Hi, Nick. > #!/usr/bin/perl This is a very good start. Never forget: use warnings; use strict; These are two of the most important lines in the script :-) If you had used these simple two lines, you would have found a ma

Re: build perl modules

2005-03-16 Thread Peter Scott
On Wed, 16 Mar 2005 08:54:33 -0500, Steve Bertrand wrote: Can anybody let me know how to create our own modules in perl. >> Another good book is _Learning Perl Objects, References and Modules_, >> Schwartz and Phoenix. I've owned the book for almost a year, and I >> still refer to it all th

Re: build perl modules

2005-03-16 Thread Wiggins d'Anconia
Peter Scott wrote: On Wed, 16 Mar 2005 08:54:33 -0500, Steve Bertrand wrote: Can anybody let me know how to create our own modules in perl. Another good book is _Learning Perl Objects, References and Modules_, Schwartz and Phoenix. I've owned the book for almost a year, and I still refer to it a

Re: Perl Analyzing Maillog

2005-03-16 Thread mgoland
- Original Message - From: Nick Chettle <[EMAIL PROTECTED]> Date: Wednesday, March 16, 2005 10:01 am Subject: Re: Perl Analyzing Maillog > Hi, Thanks, that seems a far better way to do it. A few things though: > > I am not 100% sure what this line does. $msgids is a referance to a hash,

Simple HASH query

2005-03-16 Thread SG Edwards
Hi, I am using bioperl to get the primary id of a protein out of a flat file as follows: while ($seq_obj = $seqio_obj->next_seq){ my $primary_id = $seq_obj->primary_id; print $primary_id; } exit; However, this returns: Bio::Seq::RichSeq=HASH(0xa1a1b7c) How do I get the actual value I want ou

RE: Perl Analyzing Maillog

2005-03-16 Thread Charles K. Clarkson
Nick Chettle wrote: : I am not 100% sure what this line does. : : push @{ $msgids->{$1} }, $_; : : Is the @{} surrounding the hash used to make push work with a hash? No. We cannot push items onto a hash. We need an array for that. "$msgids->{$1}" is an array refe

Re: build perl modules

2005-03-16 Thread Mahantesh Hongal
"Charles K. Clarkson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Mahantesh Hongal wrote: > > : Can anybody let me know how to create our own modules in perl. > > What would you like to place inside the modules? You can > limit yourself to just subs

Re: Question on Arrays

2005-03-16 Thread Robert
This was one of those "your moron" moments where I posted, then tried something, and the something worked. : ) Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Simple HASH query

2005-03-16 Thread Jenda Krynicky
From: SG Edwards <[EMAIL PROTECTED]> > I am using bioperl to get the primary id of a protein out of a flat > file as follows: > > > while ($seq_obj = $seqio_obj->next_seq){ > my $primary_id = $seq_obj->primary_id; > print $primary_id; > } > > exit; > > However, this returns: > > Bio::Seq::Rich

RE: build perl modules

2005-03-16 Thread Charles K. Clarkson
Mahantesh Hongal wrote: : : Just I want to place all my subs (functions) in one file i.e., module : and want to refer as and when it is needed. I can use 'require' for : this purpose but in require technique code will be included at : runtime and even if our script is wo

log output

2005-03-16 Thread Nishi Prafull
Hi: I am running a perl script as part of a cron job and I want to log the execution of the script(for sucess, failure). In my script, I make calls to external software on the machine to run certain tasks. How can I direct the output of these tasks to a local log on my machine during the execution

RE: log output

2005-03-16 Thread Paul Ohashi
What if you piped your system command to tee, like: system("$cmd1 | tee -a outfile.log") ; -Original Message- From: Nishi Prafull [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 16, 2005 10:55 AM To: beginners@perl.org Subject: log output Hi: I am running a perl script as part of a cr

Re: [PBML] Query about perl modules

2005-03-16 Thread Dave Gray
> blade:~/personal/perl > cat -n check.p > 1 #!/usr/bin/perl > 2 > 3 use Net::Telnet; > 4 > 5 $timeout = 10; > 6 $obj=new Net::Telnet( [Timeout => $timeout,] ); > 7 > blade:~/personal/perl > perl check.p > unknown remote host: ARRAY(0x22494) at check.p line 6

Math::BigInt

2005-03-16 Thread JupiterHost.Net
Hello, My goal is to divide two whole numbers and get the results to a given number of decimals. $ perl -e 'print 2/3,"\n";' 0.667 $ #!/usr/bin/perl use strict; use warnings; use Math::BigFloat; use Data::Dumper; # from http://search.cpan.org/~tels/Math-BigInt-1.74/lib/Math/BigFloat.

Re: log output

2005-03-16 Thread Nishi Prafull
I tried this system("$cmd1 | tee -a $logFile") ; but I get sh: syntax error at line 5: `|' unexpected where line 5 is the line in which I declare the var for the output log my $logFile ="/automateLabelPush.log"; On Wed, 16 Mar 2005 10:59:31 -0800, Paul Ohashi <[EMAIL PROTECTED]> wrote: > What

Re: Math::BigInt

2005-03-16 Thread Peter Rabbitson
AFAIK perl will handle up to 15 (14 to be exact) precision without any helpers like Math::BigFloat. Then you just use sprintf ('%.Xf', $var) where X is the precision you want. Keep in mind that standard rounding is enforced (.4 - .5 as breakpoint) Peter > Hello, > > My goal is to divide two

Re: Math::BigInt

2005-03-16 Thread JupiterHost.Net
Peter Rabbitson wrote: AFAIK perl will handle up to 15 (14 to be exact) precision without any helpers like Math::BigFloat. Then you just use sprintf ('%.Xf', $var) where X is the precision you want. Keep in mind that standard rounding is enforced (.4 - .5 as breakpoint) Thanks Peter I think I w

RE: log output

2005-03-16 Thread Paul Ohashi
I can't see enough to determine why your script is failing, but the four lines below work as expected: #!/usr/local/bin/perl $logFile = '/home/paulo/mylog.log'; $myCmd = 'ls -l'; system ("$myCmd | tee -a $logFile"); Hope this helps... Paul -Original Message- From: Nishi Prafull [mailto:

RE: log output

2005-03-16 Thread Chris Devers
On Wed, 16 Mar 2005, Paul Ohashi wrote: > I can't see enough to determine why your script is failing, but > the four lines below work as expected: > > #!/usr/local/bin/perl > $logFile = '/home/paulo/mylog.log'; > $myCmd = 'ls -l'; > system ("$myCmd | tee -a $logFile"); > > Hope this helps... Is

Re: Math::BigInt

2005-03-16 Thread Jay Savage
On Wed, 16 Mar 2005 13:39:34 -0600, JupiterHost.Net <[EMAIL PROTECTED]> wrote: > Hello, > > My goal is to divide two whole numbers and get the results to a given > number of decimals. [cut] > #!/usr/bin/perl > > use strict; > use warnings; > use Math::BigFloat; > use Data::Dumper; [cut] > my

Sending mail from perl with content having hyperlink

2005-03-16 Thread Nilay Puri, Noida
Hi All, I want to send mail thru perl. And the content is supposed to have hyperlink. Just one word lke, "FAQ" is supposed to have link to some url. I am trying like this, but I am not getting hyperlink on word FAQ. Can any one help here ? Thank You. sub send_mail { my ($to_email, $subject,

Re: Sending mail from perl with content having hyperlink

2005-03-16 Thread Wiggins d'Anconia
Nilay Puri, Noida wrote: Hi All, I want to send mail thru perl. And the content is supposed to have hyperlink. Just one word lke, "FAQ" is supposed to have link to some url. I am trying like this, but I am not getting hyperlink on word FAQ. Can any one help here ? Thank You. sub send_mail { my ($

Re: Math::BigInt

2005-03-16 Thread JupiterHost.Net
my $x = Math::BigFloat->new(2); Math::BigFloat->precision(5); # 5 digits max my $y = $x->copy()->bdiv(3); # will give 0.6 print Dumper $y; The docs says "will give 0.6" so how does one get $y to give you that? That is what I can't seem to find and the Dump of $y doe

Re: log output

2005-03-16 Thread Nishi Prafull
I just tried using the tctee program as follows: #!/usr/local/bin/perl5.6 -w use strict; my $logFile ='/automateLabelPush.log'; //line 5 my $tee_cmd = '/tctee.pl'; my $cmd1 = qq{ }; system("$cmd1 | $tee_cmd -a $logFile") ; at the end of the execution, I still get sh: syntax error at line 5: "|"

inplace editing

2005-03-16 Thread Hendrik Maryns
Hi, some time ago I asked for some help to eliminate certain lines from a file. Someone suggested a solution with { local ( $^I, @ARGV ) = ( '', <*.log> ); now when I run this I get the error "Can't do inplace edit without backup at lexmorf_ruisweg2.pl line 12." So I'm not sure that I understa

RE : build perl modules

2005-03-16 Thread Jose Nyimi
> -Message d'origine- > De : Charles K. Clarkson [mailto:[EMAIL PROTECTED] > Envoyé : mercredi 16 mars 2005 19:27 > À : beginners@perl.org > Objet : RE: build perl modules > > What you are describing is called "exporting" (or "importing" -- > depending on how you look at it.). There

Re: inplace editing

2005-03-16 Thread Jeff 'japhy' Pinyan
On Mar 16, Hendrik Maryns said: some time ago I asked for some help to eliminate certain lines from a file. Someone suggested a solution with { local ( $^I, @ARGV ) = ( '', <*.log> ); now when I run this I get the error "Can't do inplace edit without backup at lexmorf_ruisweg2.pl line 12." Windo

Re: inplace editing

2005-03-16 Thread Chris Charley
- Original Message - From: "Hendrik Maryns" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: Sent: Wednesday, March 16, 2005 5:35 PM Subject: inplace editing Hi, some time ago I asked for some help to eliminate certain lines from a file. Someone suggested a solution with { local ( $

platform independant log

2005-03-16 Thread Nishi Prafull
Hi : The following program needs to print the output of the cmd run to a log file, it takes care of the directory separator issue, so the log file could be created on any platform depending on where the program is run. But there is something missing ie the log file i am creating via this program do