[19652] in Perl-Users-Digest
Perl-Users Digest, Issue: 1847 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 1 00:05:30 2001
Date: Sun, 30 Sep 2001 21:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001909106-v10-i1847@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 30 Sep 2001 Volume: 10 Number: 1847
Today's topics:
Re: can I run CGI C program using mod_perl? <goldbb2@earthlink.net>
Re: Can't locate loadable objet for moule Tk:Event <bwalton@rochester.rr.com>
Re: current dir. <jurgenex@hotmail.com>
Re: Getting a perl CGI script to write to a file on ano <bart.lateur@skynet.be>
Re: HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work? (Mark Jason Dominus)
how to send mail without sendmail <yah00204052@yahoo.com>
Re: how to send mail without sendmail (Anette Stegmann)
Re: how to send mail without sendmail <mbudash@sonic.net>
Re: how to send mail without sendmail (Logan Shaw)
Re: how to send mail without sendmail <ry21@rz.uni-karlsruhe.de>
Re: how to send mail without sendmail (Logan Shaw)
Is it possible to roll a Perl program into a Win32 dll? <peichman@wam.umd.edu>
Re: Limitation <kenbrody@bestweb.net>
Re: Sorting multidimensional arrays and MIN/MAX (Martien Verbruggen)
Re: Strange results... <bwalton@rochester.rr.com>
where is the library files located? <yah00204052@yahoo.com>
Re: where is the library files located? (Clinton A. Pierce)
while loops (bal)
Re: while loops <tom.hoffmann@worldnet.att.net>
Re: while loops <echang@netstorm.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 30 Sep 2001 23:51:35 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: can I run CGI C program using mod_perl?
Message-Id: <3BB7E847.42AD38DA@earthlink.net>
eric ng wrote:
>
> I have a CGI application written / compiled in c language.
Good for you.
> what kind of apache module I need to install inorder to run it?
mod_cgi ... but this has nothing to do with perl.
> -OR- mod_perl will do it too?
mod_perl is what you need to have perl scripts run by a perl interpreter
embeded in apache. This allows you to have a cgi-like program, but
without the startup costs which a real cgi program invariably has --
that is, with real cgi, each query starts a new process, but with
mod_perl, each query calls a perl function within the server's process,
not starting any new process [and if the perl function was called once
before, it doesn't need to be loaded again... if a cgi program was
called once before, it *does* need to be loaded again].
> does CGI in C compiled code has a signaficant faster startup /
> execution time?
Than mod_perl? It depends. With a CGI program [whether C or perl], the
server has to start a new process for each request... this can take
quite a bit of overhead, so it has a slower startup than mod_perl.
However, well-written C code can execute faster than well-written perl
code... but if the startup time is dominant [and it almost invariably
is], mod_perl will be faster.
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Mon, 01 Oct 2001 00:45:59 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Can't locate loadable objet for moule Tk:Event
Message-Id: <3BB7BB10.87139340@rochester.rr.com>
olivier wrote:
...
> I have installed perl Tk under win NT and all the libraries seem to be
> present in the Perl subdirectories architecture, @INC contains also all the
> good path ..
>
> I get the following error when lauching a script using :
>
> Can't locate loadable objet for moule Tk:Event in @INC (......) at
> e:\Perl\Site\blib\lib\Tk.pm line 13 ...
>
> what is my mistake .. I think that it is an installation problem because the
> script i want to use is a known perl program that works normally fine
...
That should be Tk::event, not Tk:Event. Check your source to see if
that is the problem. And maybe comp.lang.perl.tk would be better for
Tk-related posts.
--
Bob Walton
------------------------------
Date: Sun, 30 Sep 2001 18:44:56 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: current dir.
Message-Id: <3bb7ca99@news.microsoft.com>
"Ivan" <ivank@2xtreme.net> wrote in message
news:3BB77905.1080609@2xtreme.net...
> Jeffrey Porter wrote:
> > I'm trying to write a perl program to go through each directory and list
> > the files in it & the path to that file.
> the command "pwd" gets the full current directory path. you can use it
> with perl like this:
>
> $currentdir=`pwd`; chomp $currentdir;
I hope you meant
Cwd::cwd
which would be portable and the perlish way to do it.
As for the OP: You may want to check out File::find which does all the
walking through directories for you. No need to reinvent the wheel.
jue
------------------------------
Date: Sun, 30 Sep 2001 22:16:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Getting a perl CGI script to write to a file on another server
Message-Id: <3v5frtcf7vs1bhmvl002udpokk6sd75veg@4ax.com>
Simon Pearce wrote:
>Now, this all happens on a secure server that i rent space from but I need
>the script to write the stuff to a file that exists on a different server -
>how can I do this?
You can't. But you can get that effect with the cooperation of the other
server. You should have some program listening on that server, and you
connect to it from your server, and do the request to store the data.
A simple, but likely insecure mechanism, would be to use the telnet
protocl, using Net::Telnet, to get your commands plain and simple to
that server. It would be much safer to create a dedicated server program
(a script), which does just this one thing: accept your data and store
it.
--
Bart.
------------------------------
Date: Mon, 01 Oct 2001 04:04:21 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: HELP: /stuff(\d+)|oth(\d+)/;$num=$1 doesn't work?
Message-Id: <3bb7eb44.1542$1@news.op.net>
In article <9p83kn$13n$1@neon.noos.net>,
Bruno Boettcher <bboett@bboett.dyndns.org> wrote:
>In article <3bb74fd7.4f6d$2d3@news.op.net>,
>Mark Jason Dominus <mjd@plover.com> wrote:
>>In article <9p6rka$lp2$1@neon.noos.net>,
>>Bruno Boettcher <bboett@bboett.dyndns.org> wrote:
>>>hello, i am modifying a script, and have the following scema:
>>>$pattern = "stuff(\d+)";
>>>$pattern .= "|oth(\d+)";
>>>... (a whole list...)
>>>and then i try:
>>>$line =~ /$pattern/;
>>>$num=$1;
>>
>>If $line looks like "stuff42", the 42 will be in $1.
>>But if $line looks like "oth42", the 42 will be in $2.
>argh??? but why?
Because $1 is what is in the first pair of parentheses, and $2 what is in
the second pair of parentheses. If the $line looks like 'oth42', then
there was nothing in the first pair of parentheses.
>>If you use $num=$+ instead of $num = $1, it may do what you want here.
>ok.... but if i want to fetch several submatches? i changed the script
>to the follwoing:
>#!/usr/bin/perl -w
>$line="stuff24.24";
>#$line="oth25.25";
>$pattern = 'stuff(\d+)\.(\d+)';
>$pattern .= '|oth(\d+)\.(\d+)';
Then the 'stuff' numbers will be in $1 and $2, and the 'oth' numbers
will be in $3 and $4.
When you get to this stage it's probably easier not to use $1 $2 $3 $4
directly at all. Instead, use:
@matches = ($line =~ /$pattern/);
@matches now contains a list of what is in $1 $2 $3 $4. If the $line
looks like 'stuff36.29', @matches will be ("36", "29", undef, undef),
and if the $line looks like 'oth36.29", @matches will be
(undef, undef, "36", "29").
Now you just need to scan through @matches until you find what you
want:
while (@matches && ! defined $matches[0]) {
shift @matches;
}
my ($first, $second) = @matches;
print "I see $first and $second\n";
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Sun, 30 Sep 2001 18:32:50 -0400
From: Zimmen Gnauh <yah00204052@yahoo.com>
Subject: how to send mail without sendmail
Message-Id: <3BB79D91.1247D5A9@yahoo.com>
My unix system does not have sendmail (somehow removed by admin). Is
there any way to send mail without it?
------------------------------
Date: Mon, 1 Oct 2001 00:44:08 +0200
From: anette_stegmann_@gmx.de (Anette Stegmann)
Subject: Re: how to send mail without sendmail
Message-Id: <Xns912D7472E6BFVonAnetteStegmann@news.t-online.de>
{2001-10-01 00:32} "Zimmen Gnauh":
> My unix system does not have sendmail (somehow removed by
> admin). Is
> there any way to send mail without it?
What about logging in to the MX host of the recipient on the
SMTP port and deliever the mail?
--
Es ist bewußtes tiefes Zeug, das es erfand, in ihrem Verstand.
Von ihrem verschworenen ausgezeichneten Zeug;
noch wenn einmal der Atem. Von ihrem richtigen Zeug.
Das, was sie davon überspringen kann.
------------------------------
Date: Sun, 30 Sep 2001 23:18:07 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: how to send mail without sendmail
Message-Id: <mbudash-C13C5B.16181130092001@news.sonic.net>
In article <3BB79D91.1247D5A9@yahoo.com>, Zimmen Gnauh
<yah00204052@yahoo.com> wrote:
> My unix system does not have sendmail (somehow removed by admin).
?????
> Is there any way to send mail without it?
>
one way:
use Mail::Mailer;
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 30 Sep 2001 18:22:28 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: how to send mail without sendmail
Message-Id: <9p89fk$i1s$1@charity.cs.utexas.edu>
In article <3BB79D91.1247D5A9@yahoo.com>,
Zimmen Gnauh <yah00204052@yahoo.com> wrote:
> My unix system does not have sendmail (somehow removed by admin). Is
>there any way to send mail without it?
Ask your system administrator. If they have removed sendmail, they
probably have some other system in place that they want you to use
for sending mail.
If they don't have such a system in place, you still need to talk to
them. What you're trying to do may be forbidden by a policy you don't
know about. Or it may be a genuine need that you have and it may be
allowed, and yet they have not set up the systems to handle it. In
that case, they need to be aware that their design isn't meeting your
needs because their job is to run systems that meet the organization's
needs.
Looking at it from another point of view, if you don't ask them and
they're not aware what's going on, then you may get something that
works for now, but they may change something later that suddenly makes
it not work. For example, they might block certain traffic at the
firewall and this might prevent your mail messages from getting out.
Having said all that, there are many Perl tools for
addressing this situation. Most of them are listed at
http://search.cpan.org/Catalog/Mail_and_Usenet_News/ .
The most useful is probably the Mailtools distribution with
its module Mail::Mailer.
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: 30 Sep 2001 23:28:15 GMT
From: Co Georg <ry21@rz.uni-karlsruhe.de>
Subject: Re: how to send mail without sendmail
Message-Id: <9p89qf$t5d$1@news.rz.uni-karlsruhe.de>
Hi!
> My unix system does not have sendmail (somehow removed by admin). Is
> there any way to send mail without it?
Is mailto or mailx installed on the system?
If the answer is yes, you could try:
system ("echo -e \"bla\nfoo\" |mailto ufoo\@rz.uni-karlsruhe.de -s \"topic\"");
(not very beautiful, depends on the system you have whether it works 100%)
or:
open(MAILPIPE, '|/usr/bin/mailx -s "Subject" user@host') or die "Error";
print MAILPIPE "foo\n";
print MAILPIPE "bar new line\n";
close MAILPIPE;
see the appropriate manpages.
regards: Co
--
ry21@rz.uni-karlsruhe.de
http://portal.ira.uka.de:8080
http://www.stud.uni-karlsruhe.de/~ry21
fingerprint = 47 A4 91 E3 65 D0 D3 98 4E B6 9A 79 AF 95 E4 80
------------------------------
Date: 30 Sep 2001 19:09:56 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: how to send mail without sendmail
Message-Id: <9p8c8k$ia7$1@charity.cs.utexas.edu>
In article <9p89qf$t5d$1@news.rz.uni-karlsruhe.de>,
Co Georg <ry21@rz.uni-karlsruhe.de> wrote:
>> My unix system does not have sendmail (somehow removed by admin). Is
>> there any way to send mail without it?
>Is mailto or mailx installed on the system?
>If the answer is yes, you could try:
>
>system ("echo -e \"bla\nfoo\" |mailto ufoo\@rz.uni-karlsruhe.de -s \"topic\"");
>(not very beautiful, depends on the system you have whether it works 100%)
>or:
>
>open(MAILPIPE, '|/usr/bin/mailx -s "Subject" user@host') or die "Error";
>print MAILPIPE "foo\n";
>print MAILPIPE "bar new line\n";
>close MAILPIPE;
You could try these, but if sendmail isn't installed, there's a good
chance at least mailx won't work, since the standard mailx depends on
sendmail. At least it does on my system:
# strings /usr/bin/mailx | grep sendm | sort -u
/usr/lib/sendmail
sendmail
#
(And yes, I had to do that as root because it's a setuid executable
that non-root can't read.)
Of course, the system admin might have installed a mailx replacement
that uses some other mechanism, but that would be unusual since the
usual trick if you have some other mechanism is to replace the sendmail
binary with one that behaves the same way but doesn't actually call
sendmail. (qmail does this, if I remember correctly.)
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Sun, 30 Sep 2001 22:20:51 -0400
From: Peter Eichman <peichman@wam.umd.edu>
Subject: Is it possible to roll a Perl program into a Win32 dll?
Message-Id: <3BB7D303.5000607@wam.umd.edu>
I was wondering if/how it would be possible to roll a Perl program up
into a Win32 dll. In other words, what I would like to do is write a
portion of a program in Perl, and then make it into a dll to export
functions I could call from a program another language (Visual Basic,
most likely).
I searched for "Perl dll" and found a reference to the ActiveState Perl
Development Kit; would this include the functionality I'm looking for?
(i.e., creating either plain or ActiveX dlls)
Thanks in advance,
Peter E.
(In case this info matters, I'm working on a Win32 box (Win98 SE to be
specific) with ActiveState Perl build 626)
--
"Lying sideways atop crumpled sheets and no covers, he decides to dream;
Dream up a new self, for himself."
--Pearl Jam, "I'm Open"
r a v e n s w a r d : http://www.wam.umd.edu/~peichman/ravensward
------------------------------
Date: Sun, 30 Sep 2001 14:59:49 -0400
From: Kenneth Brody <kenbrody@bestweb.net>
Subject: Re: Limitation
Message-Id: <3BB76BA5.2AC8641@bestweb.net>
gazelle@yin.interaccess.com (Kenny McCormack) writes:
> >With a PC, I always felt limited by the software available.
> >On Unix, I am limited only by my knowledge.
>
> But, of course, the real question is, what does this quote actually mean?
> Since it was posted in a Unix group, we tend to assume it is the typical
> "Unix good - Windoze bad" sort of thing, but OTOH, being attributed to
> Leader Bill, one ought to assume the contrary. And, in fact, it could
> easily be interpreted in just that way. I.e., that the whole point of the
> PC/DOS/Windoze is to remove the limitation of being limited by one's own
> wisdom (which is, let's be honest, a rare commodity in the general
> population) and instead, to allow everyone to benefit from the efforts of
> the few.
>
> I don't think this later interpretation is at all unreasonable.
Well, it's already been pointed out that the attribution to Bill Gates
was meant as a joke.
But in any case...
The key word in the quote (assuming the quote is verbatim) is "only":
On Unix, I am limited _only_ by my knowledge.
Taking that into account, there is no way it interpret any way other
than "Unix good, Windows bad".
--
+---------+----------------------------------+-----------------------------+
| Kenneth | kenbrody@bestweb.net | "The opinions expressed |
| J. | | herein are not necessarily |
| Brody | http://www.bestweb.net/~kenbrody | those of fP Technologies." |
+---------+----------------------------------+-----------------------------+
GCS (ver 3.12) d- s+++: a C++$(+++) ULAVHSC^++++$ P+>+++ L+(++) E-(---)
W++ N+ o+ K(---) w@ M@ V- PS++(+) PE@ Y+ PGP-(+) t+ R@ tv+() b+
DI+(++++) D---() G e* h---- r+++ y? (pine)
------------------------------
Date: Mon, 1 Oct 2001 10:08:08 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Sorting multidimensional arrays and MIN/MAX
Message-Id: <slrn9rfcv7.t75.mgjv@martien.heliotrope.home>
[Please in the future, put your reply _after_ the suitably trimmed text
you reply to. It is the commonly accepted quoting style on this
newsgroup, and Usenet in general]
On Sun, 30 Sep 2001 22:01:17 +0100,
S Warhurst <bigusAT@btinternetDOT.com> wrote:
[re-organised post]
Randal Schwartz wrote:
>> We could help, but we need to know what piece you are missing.
>> Do you know what @list = sort { $a <=> $b } @numbers does?
>> Do you know what $a->[1] does if $a is an arrayref?
> Well to be honest, the first thing I don't understand is about multi-d
> arrays themselves.. specifically, why one uses a $ instead of a @.. eg:
> $array[x][y] instead of @array[x][y]. It would just seem simpler to stick
> to the @.
I believe that that is exactly what they're going to do for Perl 6.
Until then, in Perl 5, you use a $ if you want a scalar, i.e. a single
element from the array, and you use @ if you want a list, i.e. you want
to access the whole array, or a slice:
@array = (1, 2, 3);
$foo = $array[2];
@foo = @array;
@bar = @array[1,2];
($foo, $bar) = @array[0,2];
For arrays of array references the situation is marginally different,
because Perl is very flexible in what it accepts as accessor syntax.
Good documentation to read for the @ vs. $ stuff is the perldata
document. Because you're working with references to build an array of
array references, I'd suggest you also read perlref, perlreftut, perllol
and perldsc (all available via the perldoc command (and man on unix, and
as HTML on ActiveState installations).
> With regard to that useful sorting line:
>
> @array = sort { $a->[1] <=> $b->[1] } @array;
>
> I don't understand why the sort uses curly brackets instead of rounded ones
> like it does if you just sort a standard 1D array.
Sort always uses curlies there:
@array = sort { $a <=> $b } @other_array;
Can you give an example with round brackets that compiles?
> What do the -> symbols
> do?.. I've seen and used them when parsing form data with cgi.pm but don't
> actually know what they do.. the term "deref" seems to get used but not sure
> what that means.
They dereference a reference.
@array = (1, 2, 3);
$foo = \@array; # $foo is now a reference to @array;
$bar = $foo->[2]; # $bar is now equal to the last element of @array
Agaian, I urge you to read perldata, perlref and perlreftut.
> In the Rex Swain concise ref guide the <=> is a numerical compare, and I
> remember reading somewhere that $a & $b have a special meanings in this
> context, but that's as far as it goes, and I also don't know what bit of the
> above line tells Perl to sort the items in ascending fashion (perhaps that's
> just a default?) and to keep the other column in the multi-d array in sync
> (again, I guess that's the default when dealing with a multi-d array).. is
> "multidimensional" the correct term to use for these types of array?
$a and $ b in a sort subroutine are set to two elements of the list you
have given it to sort.
@array = sort { $a <=> $b } 6, 2, 5, 9, 0;
$a and $b will repeatedly be set to various combinations of the 5
elements to be sorted, enought times for the algorithm to work out what
the order should be. It is the job of the sort subroutine to return a
value that's either positive, negative, or 0. When it's negative, $a is
less than $b, when it's 0 they're equal. The <=> operator does exactly
that for numbers. The cmp operator does that for strings. In Perl, the
return value of a block or subroutine is the return value of the last
executed statement, so that is the value of that operator.
In the case of a list of array references, you need the -> operator to
get to the element of the array you want to sort by:
#!/usr/local/bin/perl -w
use Data::Dumper;
$Data::Dumper::Indent = 0;
@foo = ( [1, 3], [4, 2], [9, 7], [-1, 5], [6, 6] );
@sort_0 = sort { $a->[0] <=> $b->[0] } @foo;
@sort_1 = sort { $a->[1] <=> $b->[1] } @foo;
print Dumper(\@sort_0), "\n";
print Dumper(\@sort_1), "\n";
gives us as output:
$VAR1 = [[-1,5],[1,3],[4,2],[6,6],[9,7]];
$VAR1 = [[4,2],[1,3],[-1,5],[6,6],[9,7]];
See the difference in sorting order? The first one is sorted by the
first element (0), and the other by the second element (1).
> So basically it's pretty much everything I don't understand about that ;)
I hope the above has made it a little easier. It is, however, not a
substitute for reading the documentation. You could also consider buying
a book[1].
Martien
[1] Learning Perl, 3rd ed, by Randal Schwartz (whose post you were responding
to) and Tom Phoenix, is a good recommendation. So is Elements of
Programming with Perl, by Andrew Johnson.
--
Martien Verbruggen |
Interactive Media Division | life ain't fair, but the root
Commercial Dynamics Pty. Ltd. | password helps. -- BOFH
NSW, Australia |
------------------------------
Date: Sun, 30 Sep 2001 22:33:36 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Strange results...
Message-Id: <3BB79C16.1E942721@rochester.rr.com>
Stefan Weiss wrote:
>
> "Leopold Toetsch" <lt@toetsch.at> wrote:
>
...
> Anyone care too look at the results I was getting with the script from
> my last posting? I don't want to shout 'bug!', but... it seems strange
> that the output contains all these environment settings etc.
...
> stefan
There does appear to be a bug associated with $, when it is set to
strings containing nulls (which is what your script was doing). For
example:
perl -e "$, = chr(0) x 13;print $,"
will print a bit of garble on ActiveState Perl build 629 on Windoze
98SE.
The same applies to:
$, = chr(0) x 13;
print 'a','b';
The amount and content of the garble depends on the number of nulls,
generally changing on powers-of-two changes in the string length. If
you feel strongly that this affects anything important, you might submit
a perlbug report.
--
Bob Walton
------------------------------
Date: Sun, 30 Sep 2001 22:06:25 -0400
From: Zimmen Gnauh <yah00204052@yahoo.com>
Subject: where is the library files located?
Message-Id: <3BB7CFA0.24181170@yahoo.com>
Can anyone tell me where is CGI.pl usually located in Unix system?
------------------------------
Date: Mon, 01 Oct 2001 02:56:41 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: where is the library files located?
Message-Id: <JXQt7.139199$K6.64848641@news2>
[Posted and mailed]
In article <3BB7CFA0.24181170@yahoo.com>,
Zimmen Gnauh <yah00204052@yahoo.com> writes:
> Can anyone tell me where is CGI.pl usually located in Unix system?
>
If you mean CGI.pm (you DID say library) then it's somewhere in one of
the pathnames in the @INC array.
perl -e 'print "@INC"'
One of them, yeah. "Usually" doesn't mean much since the person who
compiled and installed Perl can pick just about anywhere to have the
modules and executables install to.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: 30 Sep 2001 15:09:07 -0700
From: balsellathurai@hotmail.com (bal)
Subject: while loops
Message-Id: <58504532.0109301409.3395025e@posting.google.com>
Hi
I am using ActivePerl and I would like rthe following program to
display each of the lines with 001,002,...012,etc as opposed to
1,2,3,4,etc. Any ideas?
Cheers
Bal.
$file = 'a.txt'; # Name the file
open(INFO, $file); # Open the file
print "\nNew\n";
$qw=001;
while ($l = <INFO>) {
print $qw." "."$l";
$qw=$qw+001;
}
close(INFO);
------------------------------
Date: Sun, 30 Sep 2001 22:26:14 GMT
From: Tom Hoffmann <tom.hoffmann@worldnet.att.net>
Subject: Re: while loops
Message-Id: <a_Mt7.18129$WW.1415523@bgtnsc05-news.ops.worldnet.att.net>
On Sunday 30 September 2001 18:09, bal wrote:
> Hi
> I am using ActivePerl and I would like rthe following program to
> display each of the lines with 001,002,...012,etc as opposed to
> 1,2,3,4,etc. Any ideas?
Use 'printf' instead of 'print'
------------------------------
Date: Sun, 30 Sep 2001 22:53:16 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: while loops
Message-Id: <Xns912CC1038ADB1echangnetstormnet@207.106.93.86>
[posted and mailed]
balsellathurai@hotmail.com (bal) wrote in
news:58504532.0109301409.3395025e@posting.google.com:
> Hi
> I am using ActivePerl and I would like rthe following program to
> display each of the lines with 001,002,...012,etc as opposed to
> 1,2,3,4,etc. Any ideas?
Why didn't you read the three answers that were posted when you asked
the exact same question yesterday in
58504532.0109291522.5872229b@posting.google.com?
--
EBC
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1847
***************************************