[6969] in Perl-Users-Digest
Perl-Users Digest, Issue: 594 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 10 02:17:15 1997
Date: Mon, 9 Jun 97 23:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 9 Jun 1997 Volume: 8 Number: 594
Today's topics:
calling a command or program from Perl? <sasha@comac.spb.ru>
debugger 'X' command not working <achoy@us.oracle.com>
Find and Replace gannon@hallconsulting.com
Free Programming Rates Survey - Internet Design and Pro <mcarthur@areteinc.com>
Netscape .db files <danwang@trek.CS.Princeton.EDU>
Re: Netscape .db files (Nathan V. Patwardhan)
newbie: flat file tabulating question (Chris Martin)
Re: Newbie: How do I write to an existing file. <jbokma@caiw.nl>
Re: Output to HTML page <jefpin@bergen.org>
Re: Parsing Comma Delemited Text DataBase (Tad McClellan)
perl environment variables (Anthony Mulligan)
Perl interpreter for Windows 3.1 or MS-DOS 6.xx? <s6606555@mercury.np.ac.sg>
Perl question about filehandling josman@bigfoot.com
Re: Perl question about filehandling (Tad McClellan)
Re: PGPERL :- Solaris 2.5.1 (or HP/UX 9.04) - Binaries/ <cphillip@kerr.phys.utas.edu.au>
Re: Print lines without new-line <bad@efogm.msd.ray.com>
Re: Printing Prime Numbers (Michal Jaegermann)
Re: Problem with IF statement, Please assist <jbokma@caiw.nl>
Problem with Net::POP3 (w0zz)
Re: Regexp to get rid of foo without bar? <jbokma@caiw.nl>
Re: Regexpert's assistance required. <usenet-tag@qz.little-neck.ny.us>
Re: Suppressing Echo to STDOUT? <rra@stanford.edu>
Re: Suppressing Echo to STDOUT? (Abigail)
Re: Suppressing Echo to STDOUT? <usenet-tag@qz.little-neck.ny.us>
Re: Why 10000 + 0.63 = 10000.6299999...? (Bob Apthorpe)
Re: why won't 'print <<end_print...end_print' work? (Tad McClellan)
Re: x operator <jefpin@bergen.org>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Jun 1997 09:26:07 +0400
From: Sasha Titov <sasha@comac.spb.ru>
Subject: calling a command or program from Perl?
Message-Id: <AA7JEdpOb2@comac.spb.ru>
Hi!
I've got a programm on Perl (e.g. program_1.pl)
I want to call and running a system command or other programm
(writing on awk, bash or Perl) from my program_1.pl
For example how can I call system command "cp" (copy) or
call "program2.pl" from my main "programm1.pl"?
Thanks in advance.
Sasha
------------------------------
Date: Mon, 09 Jun 1997 19:08:34 -0700
From: Allen Choy <achoy@us.oracle.com>
Subject: debugger 'X' command not working
Message-Id: <339CB722.7F2D@us.oracle.com>
I'm having problems printing out variables with the X debugger
command. Nothing is printed whenever I do something like this:
debugger> X foo
debugger>
I'm not prepending the '$' sign, by the way.
Any ideas?
Thanks,
allen
------------------------------
Date: Mon, 09 Jun 1997 23:03:43 -0600
From: gannon@hallconsulting.com
Subject: Find and Replace
Message-Id: <865914830.19266@dejanews.com>
I am a non-perl programmer looking for for a script that will search a
directory (and sub-directories) for a specified text string and replace it
with another. The script also needs to be able to take wild-cards and to
remove strings completely (without replacing them with anything). If
anyone knows of such a script I would be grateful.
I would also be willing to pay someone $25 (negotiable) to create such a
script. Please reply by email as my usenet access is limited. Thanknyou.
-Gannon
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 09 Jun 1997 23:34:01 -0400
From: "Kenneth A. McArthur" <mcarthur@areteinc.com>
Subject: Free Programming Rates Survey - Internet Design and Promotion Discussion Groups
Message-Id: <339CCB29.5857@areteinc.com>
Hi all,
I just wanted to let you know that the McArthur Internet Design and
Promotions Website is now sponsoring free Internet Design and Promotion
Discussion Groups.
It's a place for professional and novice designers and promoters to come
to share information about building and promoting a website.
McArthur Business Systems is the host of the site and the publisher of
the MBS Developer Newsletter, a free newletter for software developers
and consultants. This newsletter is currently collecting actual
programming rate information for the 1997 Current Programming Rates
Survey published by the Newsletter.
Hope this is helpful to you,
Ken
--
Kenneth A. McArthur - McArthur Internet Design and Promotion Site
Publisher of the MBS Developer Newsletter (Free!)
Email: 73053.720@compuserve.com
Website: http://207.201.175.132/mcarthur/Welcome.html
------------------------------
Date: 04 Jun 1997 11:24:37 -0400
From: Daniel Wang <danwang@trek.CS.Princeton.EDU>
Subject: Netscape .db files
Message-Id: <r8td8q28k7d.fsf@trek.CS.Princeton.EDU>
Anyone know what format the netstape .db files are in? Anyone have a perl
script that will let me play with them?
------------------------------
Date: 10 Jun 1997 04:57:14 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Netscape .db files
Message-Id: <5nimra$dpa@fridge-nf0.shore.net>
Daniel Wang (danwang@trek.CS.Princeton.EDU) wrote:
: Anyone know what format the netstape .db files are in? Anyone have a perl
: script that will let me play with them?
I dunno. Berkeley db, maybe?
You might look into the AnyDBM_File module, which should have been
included with your Perl distribution.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 09 Jun 1997 12:38:01 GMT
From: cmartin@cycor.ca (Chris Martin)
Subject: newbie: flat file tabulating question
Message-Id: <5ngtgg$omp@storm.cycor.ca>
Hi folks !
I have a web page form that users submit a number of fields (date, name,
location, problem, comments) to a flat file, separated by "|". I have another
script which then reads in the file, and prints it in a html table. No
problem..... However, i would lilke to be able to have another script that
would read the file and summarize the results. For example, there are about
10 locations to choose from, and for each location, there are about 10
problems to choose from. I would like it to do a report such as "for each
location, there are so many of this problem type reported". The script is to
do this for all locations, tabulating the number of each problem reported.
I have read a lot of the faq's, and online tutorials, etc, but i'm really
stumped as to how to start. I know that this is probably an easy one for
experienced folks, but could someone please help a newbie by giving me some
ideas, or point me in the right direction. Thanks for any assistance you can
offer.
Cheers,
Chris
------------------------------
Date: 9 Jun 1997 20:40:51 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Newbie: How do I write to an existing file.
Message-Id: <01bc7515$95a34700$c60ab2c2@tschai>
Dick Hardcastle <dik9@desire.force9.net> wrote in article
<5nfghp$ai1@newsfeed2.force9.net>...
> Hi.
>
> I'm writing a CGI in Perl which collects data via an HTML form. I
want
> to insert this data into the file at a specific piont which will be
> marked with something like <!--Insertion Piont--> or a similar
marker.
> My problem is that I don't know how to search a file or how to
write
> to a specific piont in a file using Perl.
>
* read the file into an array
* insert the stuff
* write it out
e.g.:
open(FILE, "yourfile.html") || die "Can't open your file: $!";
while (<FILE>)
{
chomp(); # get rid of \n
push(@lines, $_); # add line to array
}
close(<FILE>);
open(FILE, "> new.html") || die "Can't open new.html: $!";
foreach $line (@lines)
{
($line = $line) ~= s/<!--Insertion Point-->/What to insert/g;
print FILE "$line\n";
}
close(FILE);
assuming that the replace is an easy one, or you can add as much s///
as needed.
Regards,
John
--
----------------------------------------------------------------------
Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)
http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]
email: jbokma@caiw.nl phone: +31 10 4291827
------------------------------
Date: Fri, 6 Jun 1997 11:20:55 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: Graham Daniell <gdaniell@wt.com.au>
Subject: Re: Output to HTML page
Message-Id: <Pine.SGI.3.96.970606112008.2921A-100000@davinci.bergen.org>
>I am an absolute beginner with PERL, trying to learn it and discover
>how it works. I have the book " Intriduction to CGI/Perl" by Brenner
>& Aoki. In it they give an example of a Perl program as follows:
All you need to do is put it in the cgi-bin directory of your server and
go to it in your browser of choice...
----------------
| "A bird in the hand leaves a nasty stain."
| - Me
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com | TechMasterJeff@usa.net
Got a JavaScript question or problem? Let me know!
------------------------------
Date: Mon, 9 Jun 1997 20:22:10 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Parsing Comma Delemited Text DataBase
Message-Id: <28ain5.4e3.ln@localhost>
Bryan Hart (bryan@eai.com) wrote:
: Larry D'Anna wrote:
: >
: > > If one or more of the fields may be 0 length, try .*? instead of .+?
: > > in the same expression above.
: >
: > I'm shure this is probably a really stupid question, but why are you
: > useing .+? instead of just .+ ? I thought you could only use one
: > multiplier after a charicter.
: >
: > --
: > Larry D'Anna
: Adding a ? makes the match non-greedy, so .+? is the non-greedy version
: of .+ (it matches the minimum, instead of the maximum).
: For example:
^^^^^^^^^^^
^^^^^^^^^^^
: $str = "foobar foobar";
: $temp1 = $str;
: $temp2 = $str;
That sure is a lot of typing.
I often economize on the amount of typing needed, especially if it
makes the code more clear as well.
: $temp1 =~ /foo.*bar/;
: $temp2 =~ /foo.*?bar/;
: $temp1 is "foobar foobar"
: $temp2 is "foobar"
^^^^^^^^^^^^^^^^^^
Huh???
--------------------
#! /usr/bin/perl -w
$temp1 = $temp2 = "foobar foobar";
$temp1 =~ /foo.*bar/;
$temp2 =~ /foo.*?bar/;
print "temp1: $temp1\n";
print "temp2: $temp2\n";
--------------------
Output:
temp1: foobar foobar
temp2: foobar foobar
Did it do that when you tested it out?
I was kinda expecting an example that showed the difference
between greedy and non-greedy quantifiers...
something like this:
-----------------------------
#! /usr/bin/perl -w
$_ = '<a href="foobar.com"><b>Foobar</b></a>';
$temp1 = $1 if /(<.*>)/; # greedy
$temp2 = $1 if /(<.*?>)/; # non-greedy
print "temp1: '$temp1'\n";
print "temp2: '$temp2'\n";
-----------------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 10 Jun 1997 04:16:08 GMT
From: avm@best.com (Anthony Mulligan)
Subject: perl environment variables
Message-Id: <avm-2708562100330001@avm.vip.best.com>
I would like to set up environment vars in a script that perform the same role
as "export" in my .profile file.
I have this line of code, but is it performing the same role as export?
and how would I modify it to include ORACLE_HOME?
$ENV{'PATH'} .= ":/tools/oracle/app/oracle/product/7.3.2";
export ORACLE_HOME=/tools/oracle/app/oracle/product/7.3.2
thanks in advance
------------------------------
Date: Tue, 10 Jun 1997 13:12:07 +0800
From: Goh Yong Kwang <s6606555@mercury.np.ac.sg>
Subject: Perl interpreter for Windows 3.1 or MS-DOS 6.xx?
Message-Id: <Pine.SOL.3.91.970610130928.7678B-100000@mercury>
I would like to write Perl scripts on my PC which is running on Win3.1
and MS-DOS but I can't find a Perl interpreter for Win3.1 or MS-DOS on the
Internet. Is there any Perl interpreter for WIn3.1 or MSDOS 6.xx? If so,
where can I download them?
------------------------------
Date: Mon, 09 Jun 1997 19:02:53 -0600
From: josman@bigfoot.com
Subject: Perl question about filehandling
Message-Id: <865899501.5910@dejanews.com>
Now, I was a social science major in college, so go easy on me.
What follows is excerpted from an online perl tutorial by Nik Silver.
"http://users.lindesign.se/perltutorial/start.html"
1: $file = '/etc/passwd'; # Name the file
2: open(INFO, $file); # Open the file
3: @lines = <INFO>; # Read it into an array
4: close(INFO); # Close the file
5: print @lines; # Print the array
Here's the question. If you're going to assign the file to an array (line
3), why do you have to assign it to a scalar first (line 1)? It seems that
it would make more sense to have line 1 read: @lines='/etc/passwd'.
I will thank any one in advance who can explain this to me.
Jos Clarebout
josman@bigfoot.com
http://www.geocities.com/athens/8239/
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 9 Jun 1997 21:34:36 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl question about filehandling
Message-Id: <sfein5.sm3.ln@localhost>
josman@bigfoot.com wrote:
: Now, I was a social science major in college, so go easy on me.
: What follows is excerpted from an online perl tutorial by Nik Silver.
: "http://users.lindesign.se/perltutorial/start.html"
: 1: $file = '/etc/passwd'; # Name the file
: 2: open(INFO, $file); # Open the file
^^^
Bad tutorial! Go sit in the corner.
You should always check return values...
: 3: @lines = <INFO>; # Read it into an array
: 4: close(INFO); # Close the file
: 5: print @lines; # Print the array
: Here's the question. If you're going to assign the file to an array (line
: 3), why do you have to assign it to a scalar first (line 1)? It seems that
^^^^^^^^^^^^^^^^^^^^^^^^^^^
You don't.
You are assigning the file *name* in line 1.
You are assigning the file *contents* on line 3.
: it would make more sense to have line 1 read: @lines='/etc/passwd'.
That might make good social sense, but not good computer science sense ;-)
Your suggested way is "hard wired" to using files.
The "filehandle" way may be a file, or it may be a pipe, or it may
be the keyboard, or ...
One mechanism no matter where the input is coming from.
: I will thank any one in advance who can explain this to me.
You can just give the filename in the open(), rather than assigning
it to a variable first:
open(INFO, '/etc/passwd') or die "could not open '/etc/passwd' $!";
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Tue, 10 Jun 1997 13:49:31 +1000
From: Chris Phillips <cphillip@kerr.phys.utas.edu.au>
To: adavid@netinfo.com.au
Subject: Re: PGPERL :- Solaris 2.5.1 (or HP/UX 9.04) - Binaries/Assistance request
Message-Id: <Pine.GSO.3.94.970610134720.14565A-100000@kerr.phys.utas.edu.au>
On Fri, 6 Jun 1997, Anthony David wrote:
> The source of my current frustration has been installing the PGPPLOT
> 2.05 package.
>
> Not having a Fortran Compiler on either machine, I have been stumbling
> along
> trying to install the f2c (makefile reader problem on Solaris) along
> with what has
> been a torturous attempt at installing gcc cand g77(gcc is a prereq).
>
If you have installed the pgplot binaries (including cpgplot) I didn't
think you needed Fortran to install pgperl. You DO need a C compiler
though.
Try:
http://www.aao.gov.au/local/www/kgb/pgperl/
It also includes pgplot binaries (not perl though).
Cheers
Chris Phillips
------------------------------
Date: Mon, 09 Jun 1997 16:07:08 -0500
From: "Brian A. Duncan" <bad@efogm.msd.ray.com>
Subject: Re: Print lines without new-line
Message-Id: <339C707C.5848@efogm.msd.ray.com>
Randal,
After adding:
use FileHandle;
STDOUT->autoflush();
to the top of my perl script, all "print" statements printed when I
expected them to (as they were executed) and were not buffered until the
program ended.
THANKS!!
--
Brian A. Duncan (_____
RES/SEL System Manager / )
Raytheon Company /_____/ *
353 James Record Road / ) (__ ___ (___
Huntsville, AL 35824 / / / ) / / \ / )
bad@efogm.msd.ray.com (______/ / / (___/ \ / /
--------------------------------------------------------------
------------------------------
Date: 9 Jun 1997 16:00:11 GMT
From: michal@gortel.phys.ualberta.ca (Michal Jaegermann)
Subject: Re: Printing Prime Numbers
Message-Id: <5nh9ab$lr0$1@pulp.ucs.ualberta.ca>
Craig Berry (cberry@cinenet.net) wrote:
:
: Actually, 1 is not considered a prime, for reasons I've never entirely
: understood. But my friend the math genius assures me it's true. :)
It is not prime because it invertible in integers (a.k.a. "unit";
another invertible integer is -1, but other rings may have more than
that).
If you include invertibles among primes then Unique Factorization theorem
(every integer can be represented as a product of powers of primes in one
and only one way - up to an order and you discount invertible factors)
falls immediately apart and, with it, a lot of other properties you
are using all the time (likely not even beeing aware of that fact :-).
An alternative is to have a zillion of special cases; even more so if you
try any of generalizations, like various polynomial rings and other stuff.
So it simply does not make any sense to include 1 among primes or you
will end up with a big mess on your hands. OTOH, 2 is definitely a
prime, at least in integers. :-)
------------------------------
Date: 9 Jun 1997 23:49:50 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Problem with IF statement, Please assist
Message-Id: <01bc752f$fc3b7900$c50ab2c2@tschai>
rk <rkl@flexsol.co.nz> wrote in article
<5nfu06$n7m$1@newsource.ihug.co.nz>...
> I have a problem with the following piece of code.
> The if statement does not work.
>
> The idea is the the datafile is read and the row from the datafile
is assigned
> to @founduser if the user name which is located in @fields[0]
matches a value.
> The value is currently hard coded to "plexus" for the test.
>
> Any assistance would be appreciated.
>
>
> open(DATAFILE, "$data_file_path") ||
> &file_open_error("$data_file_path",
> "Read Database",__FILE__,__LINE__);
> while(($line = <DATAFILE>))
> {
> unless ($line =~ /^COMMENT:/)
> {
> chop($line); # Chop off extraneous newline
> @fields = split(/\|/, $line);
> }
> $temp = @fields[0];
You probably want: $temp = $fields[0];
Tip: put a print "$temp\n"; after the assignment, so you can see
what's happening.
> if ($temp eq "plexus")
> {
> @founduser = @fields;
This means that the founduser must be unique (i.e. just one plexus in
your file)
otherwise you'll end up with the last one...
> }
> }
> close (DATAFILE);
> $phone = @founduser[4];
$founduser[4], @founduser[4] is a slice (AFAIK) and you use slices
get a piece of an
array, e.g. ($zip, $a, $b, $c, $phone) = @founduser[0..4];
> $zip = @founduser[0]; #$temp;
> &edit_profile;
> &search_results_footer;
> }
So, I think the best way to debug your script is by inserting print
statements, and
watch what is happening.. Also remember that @thingy means that you
want an array, and
$thingy that you want a scalar, so if you want one scalar form an
array: $thingy[0], and not
@thingy[0].
Regards,
John
--
----------------------------------------------------------------------
Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)
http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]
email: jbokma@caiw.nl phone: +31 10 4291827
------------------------------
Date: 10 Jun 1997 01:31:54 GMT
From: wozz@wookie.net (w0zz)
Subject: Problem with Net::POP3
Message-Id: <5niaqa$ht1$1@shiva.usa.net>
I'm writing a simple little pop client in perl for some testing applications
and have run into some problems with Net::POP3 from the libnet-1.0505 package.
the script is below
#!/usr/bin/perl
use Net::POP3;
$pop = Net::POP3->new('pophost',
Timeout => 300);
$pop->user('foo');
$pop->pass('foo');
$last = $pop->last();
print "Last message accessed: $last\n";
%list = $pop->list();
foreach $key (sort keys %list){
print "$key\n";
}
$pop->quit();
everything seems to work fine, no errors printed, the last message is
printed, but nothing ever ends up in %list, the foreach doesn't run through
even once because %list ends up being empty. Perhaps i missed the usage of
the list() method, but the above doesn't work. All i need is a list of the
messages in a mailbox. Any ideas? This is on a Solaris 2.5.1 box runnign
Perl 5.003
--
\w0zz
------------------------------
Date: 9 Jun 1997 23:55:31 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Regexp to get rid of foo without bar?
Message-Id: <01bc7530$c7ccd0a0$c50ab2c2@tschai>
Decklin Foster <mookid@ntplx.net> wrote in article
<339b665a.9890913@news.ntplx.net>...
> I would like to use a regular expression to remove any occurence of
some
> regexp (foo) that is not followed by something else (bar). I'm not
sure how to
> go about this - can someone give me an example? Thanks (Cc's are
appreciated.)
Page 68, Blue Camel:
/foo(?!bar)/ matches any occurence of "foo" that isn't followed by
"bar".
(Zero-width negative lookahead assertion 8-)
Regards,
John
--
----------------------------------------------------------------------
Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)
http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]
email: jbokma@caiw.nl phone: +31 10 4291827
------------------------------
Date: 10 Jun 1997 03:18:52 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Regexpert's assistance required.
Message-Id: <5nih2s$muk$1@news.netusa.net>
Scott Blanksteen <sibsib@hotmail.com> wrote:
> Simon Fairey wrote:
[convert]
> > item1, function1([0,11], function2() ), item2
[to]
> > item1
> > function1([0,11], function2() )
> > item2
> If you know that your 'item1' and 'item2' won't have commas
> in them, then just use
Ah, come on. What if they do have commas? What then, huh, huh?
This is a seriously difficult task for regular expressions. You
are *much* better off using some other sort of parsing. The FAQ
has got to have an entry on how to match properly nested parens
to X deep. Go off and read that. Then maybe get a book on automata
and learn why X must be fixed when matching with regexps. The
reasons hold even for perl's superset of the math concept, I am
quite confident. Certainly Friedl made no attempt to match parens
more than two deep in his regexp to match email addresses for
_Mastering Regular Expressions_.
Elijah
------
regexp guru
------------------------------
Date: 09 Jun 1997 17:30:21 -0700
From: Russ Allbery <rra@stanford.edu>
To: gerdemb@rice.edu (Ben Neil Gerdemann)
Subject: Re: Suppressing Echo to STDOUT?
Message-Id: <m3g1urwb8i.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Ben Neil Gerdemann <gerdemb@rice.edu> writes:
> I would like to use Perl to input data from the keyboard without echoing
> it to the screen (like the way passwd works.) How is this possible?
See the section of man perlfunc under, of all things, crypt(). There's an
example there of how to use stty -echo. Note that that will only run
under Unix; I don't know of a platform-independent way of doing this.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 10 Jun 1997 03:03:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Suppressing Echo to STDOUT?
Message-Id: <EBJHtG.752@nonexistent.com>
Russ Allbery (rra@stanford.edu) wrote on 1379 September 1993 in
<URL: news:m3g1urwb8i.fsf@windlord.Stanford.EDU>:
++
++ See the section of man perlfunc under, of all things, crypt(). There's an
++ example there of how to use stty -echo. Note that that will only run
++ under Unix; I don't know of a platform-independent way of doing this.
print "Please turn of your monitor\n"; # Works for many systems.
Doesn't work for hardcopy terminals though.
Abigail -- Don't take me serious.
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: 10 Jun 1997 03:39:26 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Suppressing Echo to STDOUT?
Message-Id: <5nii9e$nhm$1@news.netusa.net>
Abigail <abigail@fnx.com> wrote:
> Russ Allbery (rra@stanford.edu) wrote on 1379 September 1993 in
Say Abigail, that's a strange date on your attribution.
> ++ See the section of man perlfunc under, of all things, crypt(). There's an
> ++ example there of how to use stty -echo. Note that that will only run
> ++ under Unix; I don't know of a platform-independent way of doing this.
> print "Please turn of your monitor\n"; # Works for many systems.
> Doesn't work for hardcopy terminals though.
They might be able to take the ribbon out, though. Still might leave
an impression, true, but....
> Abigail -- Don't take me serious.
But why not? :^) I still use performance under hardcopy terminals as
part of my Eli's-Seal-of-Vi-Compatibility test suite. (Last time I
checked vim was doing pretty bad on that test. No open mode and no ex
mode. And vast inefficienies with display updates which will effect
all slow terminals adversely.)
> perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
This just prints garbage when I run it. And, you do know that <caret><char>
works just as well as the real control characters, right? Think about the
poor sap trying to read this on his hardcopy device.
Elijah
------
Does your vi lack life? <URL:http://www.netusa.net/~eli/src/life.html>
------------------------------
Date: Tue, 10 Jun 97 04:10:04 GMT
From: arclight@io.com (Bob Apthorpe)
Subject: Re: Why 10000 + 0.63 = 10000.6299999...?
Message-Id: <5nik2u$du3@news.jump.net>
In article <338F2974.28CC@esd.sgi.com>, Tian Chi <tian@esd.sgi.com> wrote:
>I was testing the following Perl script,
>but got a wrong result? Why is that?
>
>[snip]
>
>Any help would be appreciated.
The first chapter or two of a numerical analysis textbook will make this very
clear. Even if you don't expect to be doing gobs of scientific programming, a
little numerical analysis knowledge will help you recognize and avoid
pitfalls like this.
Depending on what you're doing, here are a few suggestions:
1) Determine what level of error you're willing to live with and consistently
base your comparisons on this.
Example: Use
my $eps = 0.000005;
if (abs($b - $a) < $eps) {
# $b mostly_equals $a
}
instead of
if ($a == $b) {
# $a and $b are equal - pure luck!
}
2) Use integer or fized-precision math if your problem lends itself to that
method (e.g. currency)
3) Otherwise, investigate arbitrary-precision techniques if you need that kind
of accuracy. Of course, if you need this level of detail, you probably should
have more background in numerical analysis...
Bob Apthorpe
"Measure with a micrometer, mark with a pencil, cut with an axe..."
------------------------------
Date: Mon, 9 Jun 1997 20:11:14 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: why won't 'print <<end_print...end_print' work?
Message-Id: <ij9in5.kb3.ln@localhost>
Bryan Hart (bryan@eai.com) wrote:
: > Will Sexton wrote:
: > >
: > > If I do the following:
: > >
: > > print <<"end_print";
: > > some text
: > > some text on the next line
: > > end_print
: > >
: Also, I don't think that you should double-quote the terminator string
: either...
Why not?
An answer without a reason is of significantly reduced value.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Mon, 9 Jun 1997 08:01:38 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: the count <eglamkowski@mathematica-mpr.com>
Subject: Re: x operator
Message-Id: <Pine.SGI.3.96.970609080009.5007C-100000@davinci.bergen.org>
>I have an array I want to initialize, and was curious if the following
>syntax was valid:
>
>@current_disp_table = ( 32, (-1) x 19, 19..31, (-1) x 7 );
>
>which I want to be a 40 element array of integers.
sorry... not gonna happen
>Or am I misunderstanding the x operator here?
yes :)
x works like this:
$str = "-=-" x 10;
print $str;
output is -=--=--=--=--=--=--=--=--=-
or the "-=-" 10 times. Ok?
----------------
| "You care... but I don't care."
| - Ken Mayers
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com | TechMasterJeff@usa.net
Got a JavaScript question or problem? Let me know!
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 594
*************************************