Re: Is there a better way to get current tty name

2008-10-27 Thread Yue Chen
Sorry, I've got the answer. It should be $mytty = POSIX::ttyname(1); 2008/10/28 Yue Chen <[EMAIL PROTECTED]>: > Hi > > I am writing a perl script which need send current tty to another program. > > Now i am using external cmd 'tty' and redirect the result to my > variable, such as: > > $mytty =

Is there a better way to get current tty name

2008-10-27 Thread Yue Chen
Hi I am writing a perl script which need send current tty to another program. Now i am using external cmd 'tty' and redirect the result to my variable, such as: $mytty = `tty`; Since sometimes 'tty' is not in my PATH, my script is not always successful. So is there a better perl internal mecha

Re: match and putting in a variable with a single statement

2008-10-27 Thread John W. Krahn
Jenda Krynicky wrote: From: "Chas. Owens" <[EMAIL PROTECTED]> On Oct 24, 2008, at 11:00, "Sharan Basappa" <[EMAIL PROTECTED]> wrote: I was just trying to match a string and save it in a single statement as follows: $extracted = "cp xyz"; $state_var = $extracted =~ m/cp\s+(.*)/; print "$state

Re: Curly braces and the logic of PERL

2008-10-27 Thread Chas. Owens
On Mon, Oct 27, 2008 at 20:28, Rob Dixon <[EMAIL PROTECTED]> wrote: > John W. Krahn wrote: >> >> The fewer lines of code to read and/or write, the easier it is to spot >> mistakes, the less chance for "action at a distance." > > Not at all. > > Is this > > sub wanted { return unless -f; open my $FH

Re: nested loop

2008-10-27 Thread Rob Dixon
Adams Paul wrote: > Hello everyone, > I have a program which navigates to a page and then extracts the links and > navigates > to each of those links.It works fine for the first web page(the program > navigates to > the first page and then extracts the links and visits all the links).When I > th

Re: Curly braces and the logic of PERL

2008-10-27 Thread Rob Dixon
John W. Krahn wrote: > > The fewer lines of code to read and/or write, the easier it is to spot > mistakes, the less chance for "action at a distance." Not at all. Is this sub wanted { return unless -f; open my $FH, '<', $_ or die "Cannot open '$_' $!"; while ( <$FH> ) { /\Q$string/ && print $

nested loop

2008-10-27 Thread Adams Paul
Hello everyone, I have a program which navigates to a page and then extracts the links and navigates to each of those links.It works fine for the first web page(the program navigates to the first page and then extracts the links and visits all the links).When I then try to get the program to na

Re: match and putting in a variable with a single statement

2008-10-27 Thread Jenda Krynicky
From: "Chas. Owens" <[EMAIL PROTECTED]> > On Oct 24, 2008, at 11:00, "Sharan Basappa" <[EMAIL PROTECTED]> > wrote: > > > Hi, > > > > I was just trying to match a string and save it in a single statement > > as follows: > > > > $extracted = "cp xyz"; > > $state_var = $extracted =~ m/cp\s+(.*)/; >

Re: Replace a specific block of data

2008-10-27 Thread Brian
Jay Savage wrote: On Mon, Oct 27, 2008 at 7:32 AM, Brian <[EMAIL PROTECTED]> wrote: Hello again Not too sure how to pose this question, but here goes. Working on an html page. There are many blocks of code placed between and in the page. The block(s) I am playing with have seven lines of co

Re: Replace a specific block of data

2008-10-27 Thread Jay Savage
On Mon, Oct 27, 2008 at 7:32 AM, Brian <[EMAIL PROTECTED]> wrote: > Hello again > > Not too sure how to pose this question, but here goes. > > Working on an html page. > There are many blocks of code placed between and in the page. > > The block(s) I am playing with have seven lines of code place

Re: Curly braces and the logic of PERL

2008-10-27 Thread Octavian Rasnita
"the basic intent is to provide visual clues" Well, this is a limited approach, generated exactly by the fact that some programmers don't really care about all those who read, but care the most about their own preferences. I am blind and the visual clues don't mean anything, but make the thin

Re: Curly braces and the logic of PERL

2008-10-27 Thread John W. Krahn
Brian wrote: Mr. Shawn H. Corey wrote: This code is written this way because the coder has been playing too much Perl Golf ;) The objective of Perl Golf is to write a program to do a simple task in the least number of characters possible. This, of course, makes it harder to read. I must adm

Re: Curly braces and the logic of PERL

2008-10-27 Thread Brian
Mr. Shawn H. Corey wrote: On Mon, 2008-10-27 at 17:05 +, Brian wrote: Hello This code is written this way because the coder has been playing too much Perl Golf ;) The objective of Perl Golf is to write a program to do a simple task in the least number of characters possible. This, of

Re: Curly braces and the logic of PERL

2008-10-27 Thread Brian
Bob McConnell wrote: From: Brian Why is it "good practice" to write PERL the way it is done? Discussing coding styles often degenerates into a religious and/or political argument, but I will try an overview. Don't worry, I'll be gentle. If you care to notice, even the prose above has a c

Re: Curly braces and the logic of PERL

2008-10-27 Thread John W. Krahn
Mr. Shawn H. Corey wrote: On Mon, 2008-10-27 at 17:05 +, Brian wrote: Why is it that some code has no curly braces after print; whilst in others I sometimes see one or more curly braces after it? Will there be a time when print; will fail because there isn't a curly brace following it, ev

Re: Curly braces and the logic of PERL

2008-10-27 Thread Mr. Shawn H. Corey
On Mon, 2008-10-27 at 17:05 +, Brian wrote: > Hello > > Years ago I used to work with FORTRAN, RPG GAP 2 and a smidgeon of basic. > Code was written one line at a time, the first section of code was Input > data, the next section was calculations, the last section was output. > (For example,

RE: Curly braces and the logic of PERL

2008-10-27 Thread Bob McConnell
From: Brian > > Why is it "good practice" to write PERL the way it is done? > Discussing coding styles often degenerates into a religious and/or political argument, but I will try an overview. The purpose for arranging code in various styles is to assist the next programmer on the project. Whil

Re: Curly braces and the logic of PERL

2008-10-27 Thread Brian
Telemachus wrote: On Mon Oct 27 2008 @ 5:05, Brian wrote: An example of something confusing me is in the sample below find sub { return unless -f; open my $FH, '<', $_ or die "Cannot open '$_' $!"; while ( <$FH> ) { /\Q$string/ && print $REPORT "$File::Find::name\n"

Re: Curly braces and the logic of PERL

2008-10-27 Thread Brian
John W. Krahn wrote: Brian wrote: Hello Hello, An example of something confusing me is in the sample below find sub { return unless -f; open my $FH, '<', $_ or die "Cannot open '$_' $!"; while ( <$FH> ) { /\Q$string/ && print $REPORT "$File::Find::name\n" and

Re: Curly braces and the logic of PERL

2008-10-27 Thread Telemachus
On Mon Oct 27 2008 @ 5:05, Brian wrote: > An example of something confusing me is in the sample below > find sub { > return unless -f; > open my $FH, '<', $_ or die "Cannot open '$_' $!"; > while ( <$FH> ) { > /\Q$string/ && print $REPORT "$File::Find::name\n" and > re

Re: Curly braces and the logic of PERL

2008-10-27 Thread John W. Krahn
Brian wrote: Hello Hello, Years ago I used to work with FORTRAN, RPG GAP 2 and a smidgeon of basic. Code was written one line at a time, the first section of code was Input data, the next section was calculations, the last section was output. (For example, in the sample of code below, the "w

Curly braces and the logic of PERL

2008-10-27 Thread Brian
Hello Years ago I used to work with FORTRAN, RPG GAP 2 and a smidgeon of basic. Code was written one line at a time, the first section of code was Input data, the next section was calculations, the last section was output. (For example, in the sample of code below, the "while" line would have b

Replace a specific block of data

2008-10-27 Thread Brian
Hello again Not too sure how to pose this question, but here goes. Working on an html page. There are many blocks of code placed between and in the page. The block(s) I am playing with have seven lines of code placed between and , (repeated a number of times throughout the page) but which

RE: problem using mime::lite

2008-10-27 Thread sanket vaidya
Hi all, The problem was with the text file. I have solved it. Now pl. don't work for this mail. Thanks Sanket Vaidya _ Hi all, I want to send mail using mime::lite to email addresses in text file (say list.txt). Say the ids are [EMAIL PROTECTED], [EMAIL PROTECTED] & so on.

problem using mime::lite

2008-10-27 Thread sanket vaidya
Hi all, I want to send mail using mime::lite to email addresses in text file (say list.txt). Say the ids are [EMAIL PROTECTED], [EMAIL PROTECTED] & so on. My code is use MIME::Lite; my $user = 'myname'; my $pass = password'; open FH,'D:\perlprogs\list.txt'; @array = ; MIME

Re: recurse dir & files

2008-10-27 Thread Brian
Thank you John, your help has been very much appreciated. Statistics for anyone interested. AMD Athlon XP 2000 1.67GHz 1.25 GB RAM DDR run time 11:32:23 (folder properties) Size 2.38 GB (2,562,436,341 bytes) Size on disc 9.83 GB (10,565,791,744 bytes) 2,574,662 files, 11 folders Not sure what