[6609] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 234 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 4 12:17:14 1997

Date: Fri, 4 Apr 97 09:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 4 Apr 1997     Volume: 8 Number: 234

Today's topics:
     Re: Expand $variables (David Alan Black)
     handling image files? <ian@orangenet.co.uk>
     Re: Help Doing a chomp type function <mgjv@comdyn.com.au>
     Re: How to extract string starting with n characters? (David Alan Black)
     Re: How to get key from value in a %VAR (David Alan Black)
     Re: New Perl Web Page (Bill Kannawin)
     Re: New white paper on scripting <cimarron@dis.org>
     Re: Ousterhout and Tcl lost the plot with latest paper (Donal K. Fellows)
     Re: PERL 5.0 on Windows 95... <joelf@volpesys.com>
     Re: PERL 5.0 on Windows 95... <joelf@volpesys.com>
     Re: PERLscript with URL redirection (Nathan V. Patwardhan)
     problem with file handling in perl <niere@ntep.nec.co.jp>
     Re: Problems with objects (Odd Number of elem. in hash  (David Alan Black)
     Re: Replacing text <aulamac@univ.it>
     Re: Replacing text (David Alan Black)
     submitting from another frame (Alex Chernyavsky)
     symbolic reference doesn't work with arrays? <Brett.W.Denner@lmtas.lmco.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 4 Apr 1997 14:48:51 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Expand $variables
Message-Id: <5i34cj$q7f@pirate.shu.edu>

Hello -

pontus@se.adsanker.com (Pontus Berglund) writes:

>Hi!

>I'm quite new to Perl, and I have a slight problem. I've tried finding
>an answer elsewhere, but failed. My problem is best explained with an
>example. I want to expand variables in lines of text that are read
>from a file. What I've got is this:

>I have a text file from which the lines are read:

>lines.txt
>---------
>Today is $date.
>Another line of text.

>The script looks like this:

>script.pl
>---------
># Read the lines from lines.txt into the array @arr.
># $i is the index.
>$date="Monday";
>while (<INFILE>) {
>	s/str/$arr{i}/g;
>	print $_;
>}

>I want the script to replace the string str with "Today is Monday.",
>but it replaces str with "Today is $date.". If I write the script like
>this it works:

But the string "str" doesn't occur anywhere in your input file, so
no substitution is taking place.  Also, your index variable isn't
a variable - it's a bareword (no $), and I'm not sure what you
want it to do anyway.

>script2.pl
>----------
>$text="Today is $date.";
>$date="Monday";
>while (<INFILE>) {
>	s/str/$arr{i}/g;
>	print $_;
>}

The results of this will be the same as the results of the first script.
All you've done is assign a value to $text, which has nothing to do
with <INFILE>.

Either of your script excerpts could be rewritten:

print <INFILE>;

If you want to substitute the value of any scalar $scalar for the
string "$scalar", you could do:

open (INFILE, "lines.txt") or die $!;
$date = "Monday";

while (<INFILE>) {
    s/\$(\w+)/${$1}/g;
    print;
}

or if you just want to change "$date" to the value of $date, change
the s/// line to:

	s/\$date/$date/g;


David Black
dblack@icarus.shu.edu


------------------------------

Date: 4 Apr 97 15:25:25 GMT
From: "ian hothersall" <ian@orangenet.co.uk>
Subject: handling image files?
Message-Id: <01b58691$b06a67e0$18a0dac1@peel.orangenet.co.uk>

Hi
Thanks for taking a look.
I've just written my first perl script - a page counter that out-puts HTML.
However I have noticed that other page counters are called from within an
HTML page using <img src="cgi-bin/counter.pl>. Presumably these scripts
read-in and write-out gif files. How is this done? Can I download any
examples?

Thanks 
Ian Hothersall


------------------------------

Date: Fri, 04 Apr 1997 12:30:19 +1000
From: Martien Verbruggen <mgjv@comdyn.com.au>
To: Allen May <allenm@lexis-nexis.com>
Subject: Re: Help Doing a chomp type function
Message-Id: <334467BB.4DCA@comdyn.com.au>

Allen May wrote:
> 
> I want to find where each users home account is.. I am doing
> a:

>           $local = `ypcat passwd | grep $person`;

That is sort of heavy on the system, isn't it? starting a ypcat for each
line in that file? Besides that, it assumes that yp is installed.

Maybe you would be better off doing something like this:

#!/usr/local/bin/perl5 -Tw
use strict;
my $person;
open (USERS, "user_list") || die "Could not open file: $!";
 
while ($person = <USERS>) {
    chomp($person);                         # get rid of \n
    ($person =~ /^\s*$/) && next;           # Skip empty lines
    my @pwent = getpwnam($person);          # Get passwd info by name
    if ( $#pwent == -1 ) {
        print "User: $person -> NOT FOUND\n";
    }
    else {
        print "User: $pwent[0] -> $pwent[7]\n";
    }
}
close(USERS);


This should work, whatever password mechanism is in place, and doesn't
use any child shell processes. 

Hope this helps,
-- 
Martien Verbruggen

Webmaster www.tradingpost.com.au
Commercial Dynamics Pty Ltd, N.S.W., Australia


------------------------------

Date: 4 Apr 1997 15:08:40 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: How to extract string starting with n characters?
Message-Id: <5i35ho$sns@pirate.shu.edu>

Hello -

Jim Michael <jim.michael@gecm.com> writes:

>I am looking for a function for extracting a string starting with a 
>specific substring, and ending with a specific character, e.g. all names 
>starting with "John", ending with a space (Johnson, Johnstone, Johns,..).

Welcome to the world of regular expressions.  

	$record = "Lyndon Johnson was from Texas";
	($johnpart) = $record =~ /(John\w+)/; 

or (John\w+ ) if you want the space to be part of the return string.

>Does this already exist in Perl? Pointer to appropriate reference 
>appreciated. TIA.

Pointers to references are another matter :-)

But do buy/read:

Programming Perl
Mastering Regular Expressions   <--- everybody - buy this.


David Black
dblack@icarus.shu.edu


------------------------------

Date: 4 Apr 1997 15:01:05 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: How to get key from value in a %VAR
Message-Id: <5i353h$rn8@pirate.shu.edu>

Douglas Seay <seay@absyss.fr> writes:

>basj wrote:
>> 
>> I need to get the key that belongs to a value in a %VAR. How do I do that ?
>> I can get the value if I have a key but I need to do the reverse lookup.

>use each() and check each key/value pair.
>note that values are not necessarily unique,
>so be prepared for multiple matches.

If you are sure that the values are unique (as in: *very* sure), and
if the hash isn't too big, you could do:

my %hash = ( 1 => 'a', 2 => 'b', 3 => 'c');

print ${{reverse(%hash)}}{c};  # prints 3


I haven't benchmarked it, but I'll go out on a limb and guess that
it isn't terribly efficient... but might come in handy for occasional
use as directed.


David Black
dblack@icarus.shu.edu




------------------------------

Date: 4 Apr 1997 08:33:03 -0700
From: kannawin@q.osmre.gov (Bill Kannawin)
Subject: Re: New Perl Web Page
Message-Id: <5i36vf$2pe@q.osmre.gov>


In article <3342d896.188754067@news.onr.com>, jason@cimedia.com (Jason Bodnar) writes:
|> Jason Many <cgi@ctfire.com> wrote:
|> 
|> >A brand new CGI/Perl web page has just opened!
|> >
|> >Check out The CGI-BIN at http://www.ctfire.com/thebin/
|> >
|> >It's the largest single collection of CGI scripts on the web!
|> >
|> >The CGI-BIN includes CGI scripts to run message boards, chat programs, 
|> >passworded pages, mailing lists, shopping carts, and a lot more!
|> >
|> 
|> Great, just what we need. Another site giving out free CGI programs
|> that will have countless people flocking to c.l.p.m with their
|> problems even though CGI does not appear once in the name of the
|> newsgroup.
|> 
|> 
|> -- 
|> Jason C. Bodnar
|> jasonb@onr.com
|> Internet Programmer
|> Cox Interactive Media

They aren't even free.


------------------------------

Date: Fri, 04 Apr 1997 08:33:24 -0800
From: Cimarron Taylor <cimarron@dis.org>
Subject: Re: New white paper on scripting
Message-Id: <33452D54.69DF@dis.org>

Tom Christiansen wrote:
> To me, the whole notion that there exist two kinds of languages [...]
> is a facile oversimplification loaded with false dualism.  Reality would
> seem to be that items in those columns float freely back and forth
> depending on many factors, and pretending that they are two sides of a coin
> ignores many shades of grey as well as unrelated orthogonal axes.

	Tom, I couldn't agree with you more.

> 
> Cannot compiled languages glue things together?  Cannot interpeted
> languages be used for systems programming (think of BASIC-PLUS and RSTS/E
> for a non-Unix example)?  Is there some reason why interpreters should
> not have objects, or compilers dynamic/fluid types?  I can compile awk
> or Perl into C, and thence to assembler and machine language.  Or I can
> run C or Pascal in an interpreted environment.  Does that all of a sudden
> change what they are?
> 
> I don't think so.
> 
> Many of the other points are valid, but it just seems too much a case
> of black and white.

	I feel Mr Ousterhout's paper is well written and well
	thought out but it proposes definitions which are a drastic 
	oversimplification of the diversity of computing and the
	relationships between languages and the specific problems
	they are intended to solve.  

	For example, the paper ignores many languages (such as SQL, 
	APL, Prolog, Smalltalk and Lisp) which do not fit into two
	language model proposed.  As a result I feel the conclusions it
	draws cannot not be considered more generally true outside
	the specific cases it mentions.  


	Cimarron Taylor
	cimarron@dis.org


------------------------------

Date: 4 Apr 1997 15:49:23 GMT
From: fellowsd@cs.man.ac.uk (Donal K. Fellows)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <5i37u3$s0a@m1.cs.man.ac.uk>

In article <s6y208um0ey.fsf_-_@aalh02.alcatel.com.au>,
Chris Bitmead  <Chris.Bitmead@alcatel.com.au> wrote:

Chris, please cut out the bits of message that you are not directly
responding to, especially with long posts.  We don't all have optic
fibre connections to our newsservers... :^)

> chen@adi.COM (Franklin Chen) writes:
> 
> > I've looked at the paper, and found it extremely misleading for its
> > omissions and factual inaccuracies.  In particular, I was baffled that
> > there was no mention _whatsoever_ of advanced languages such as
> > Scheme, ML, and Haskell--languages that to me seem most promising as
> > foundations for safe, efficient, and expressive prototyping/scripting
> > as well as general purpose programming.
> > 
> > If anyone is interested, I can go into detail about everything I found
> > misleading about Ousterhout's paper.  I encourage anyone else who
> > cares to do the same; perhaps an eventual unified response to
> > Ousterhout is called for.
> 
> 
> The essence of Ousterhout's argument seems to be this... What is the
> ultimate sports car (programming language)? A '59 Cadillac complete
> with fins and powerful engine (C++) or a VW beetle with it's elegant
> simplicity (Tcl). John puts forward a strong argument that the beetle
> is the ultimate sports car, while conveniently ignoring that it is
> possible to combine the powerful engine of the Caddy with the elegance
> of the VW and come up with a Porche 959 (Scheme or Lisp or ML or many
> others).

But then they stick the steering wheel to the ceiling, the accelerator
in the boot, and almost completely fail to advertise the fact that
they have this wonderful vehicle.

Rule 1:  Technical superiority counts for virtually nothing if the
         other person's system has many times more users and
         developers.  'Doze is proof enough of this...

> These are my comments on his paper. Remember that Sun is pushing Tcl
> for some obscure reason, and Ousterhout is apparently working for Sun
> now, so I guess we'd expect something like this, but we can't let him
> get away with this. Imagine... C and TCL. The worst of all possible
> worlds.

Well, I reckon that the world should be ditching Scheme and Lisp in
favour of a more modern and superior language like SML.  Doesn't mean
that it is going to happen though.  Oh, and the worst of all possible
worlds doesn't come from Mountain View, but Redmond...

[ snippage - double-quoted stuff is from JO's paper:
    http://www.sunlabs.com/people/john.ousterhout/scripting.html
]
> A brave beginning! Ousterhaut tries to characterise Tcl as some sort
> of next generation language that is some sort of higher level
> abstraction above non-scripting languages.
> 
> Talk about turning a bug into a feature! Apparently because Tcl lacks
> fundamental language concepts such as data structures, and a type
> system, it is now superior because it is "simple". I guess that makes
> BASIC another superior language of the future. NOT!

Well, his paper is targetted at the C/C++/Java crowd.  If you said
Scheme to them, they'd probably start plotting to overthrow the CEO...

> >System programming languages differ from assembly languages in two
> >ways: they are higher level and they are strongly typed. The term
> >"higher level" means that many details are handled automatically so
> >that programmers can write less code to get the same job done. For
> >example:
> 
> Where did this very dubious definition of a "system programming
> language" come from?? I don't think there is any official definition,
> but these are the attributes I personally would use to describe a
> systems language. They certainly don't include Ousterhout's
> definition...

He pulled it out of the air, but it is his show, and he is allowed to
do that sort of thing.  Quibbling with peoples' definitions is a
standard USENET debating techinque, I know, but it doesn't really
advance the discussion in this case.

> >Modern computers are fundamentally typeless at heart: any word in
> >memory can hold any kind of value, such as a character, an integer, a
> >pointer, or an instruction. The meaning of a value is determined by
> >how it is used: if the program counter points at a word of memory then
> >it is treated as an instruction; if a word is referenced by an integer
> >add instruction then it is treated as an integer; and so on. The same
> >word can be used in different ways at different times.
> 
> Modern computers are not "typeless"! While I find this whole argument
> meaningless anyway, if you want to make the comparison, you would say
> that computers are dynamically typed, but nevertheless typed. In that
> respect they compare better to dynamically typed languages like
> Lisp. While a piece of computer memory can hold data of any type,
> (Like a lisp variable), computer instructions only operate on the
> correct type. You can't use an add instruction and pass it a string
> with some ascii numbers in it (Similar to Lisp).

You, sir, are wrong here.  Completely wrong.  Modern processors
wouldn't know the difference between a complex data structure
reference, a string, a floating point number, the code for a function
and a collection of line noise.  They are all just (sequences of)
bytes/words.  You can't generally look at a bit pattern and tell what
it means, even if you know the host architecture/OS.  Eg. "gc[k" is a
word-sized portion of a file on my workstation, but you would be very
hard-pressed indeed to be able to tell the format of the file from
that (FYI, it is an Sun audio file that makes my workstation say
something sarcastic if I'm still logged in when I should be going to
catch my train home :^) since it could quite easily be from any number
of other formats - some binary and some textual.  The key is that the
processor doesn't care.  It is _software_ that cares - types are
implemented in software only.

> >A typeless language makes it much easier to hook together
> >components. There are no a priori restrictions on how things can be
> >used, and components and values are represented in a uniform
> >fashion. Thus any component or value can be used in any situation;
> >components designed for one purpose can be used for totally different
> >purposes never foreseen by the designer. For example, in the Unix
> >shells, all filter programs read a stream of bytes from an input and
> >write a string of bytes to an output so any two programs can be
> >connected together simply by attaching the output of one program to
> >the input of the other.
> >
> >The strongly typed nature of system programming languages discourages
> >reuse. Programmers are encouraged to design a variety of incompatible
> >interfaces. Each interface requires objects of specific types and the
> >compiler prevents any other types of objects from being used with the
> >interface, even if that would be useful. In order to use a new object
> >with an existing interface, conversion code must be written to
> >translate between the type of the object and the type expected by the
> >interface. This in turn requires recompiling part or all of the
> >application, which isn't possible in the common case where the
> >application is distributed in binary form.
> 
> A fairly poor attempt to gloss over the issues here. Converting
> everything to strings does not solve anything except in the most
> trivial cases. Just because you encode some complex concept into a
> single string doesn't mean that the type information isn't still
> there. The simplest case is of course passing a string to an add
> function. At run time you've still got to know that the string
> contains a number. Again Ousterhout conveniently ignores the
> dynamically typed languages and glosses over the real issues.

One man's real issue is another man's insignificance.  In terms of
important things like time-to-delivery/market,  Tcl (along with the
other scripting languages) is at a tremendous advantage over languages
like C (Fortran, C++, etc.).  This gives its users much greater
competitiveness in a world where change is ever more rapid.  OK, so
the solutions may not be quite the most elegant possible, but they are
there far sooner, and are easy enough to maintain (especially given
that the cost of replacing substantial sections of the system is
fairly low).

If you want to really demonstrate how much better Scheme (or Lisp, or
ML, or whatever) is, perform a comparative coding test (such as
documented in JO's table #1) which, while anecdotal, does illustrate
the ability of scripting languages to make a huge difference to the
cost of major projects.

In my experience, some of the best features of scripting languages are
the ability to use them to perform separate testing of disparate
system components before the integration of them into a complex whole.

[ button example elided ]
> Come on! All this shows is the inconveniece of using the MFC
> classes. An interface exactly the same as the Tcl one could easily be
> written in C++.

Oh?  I'd love to see you try it.  (Clue: the configuration parameters
can be in any order, and there are a lot more that have been omitted.
C++ offers no good support for this at all.)

> >The difference is that scripting
> >languages do their error checking at the last possible moment, when a
> >value is used. Strong typing allows errors to be detected at
> >compile-time, so the cost of run-time checks is avoided. However, the
> >price to be paid for this efficiency is more conservative restrictions
> >on how information can be used: this results in more complex and less
> >flexible programs.
> >
> >Another key difference between scripting languages and system
> >programming languages is that scripting languages are usually
> >interpreted whereas system programming languages are usually
> >compiled. 
> 
> "Usually" perhaps, but not always. Surely the best solution is a
> language which can easily accomodate both options? Tcl does not at all
> easily support compilation. C++ does not easily support
> interpretation. There are many languages which readily support both.

Tcl8 does support JIT compilation to bytecode (though not separate
compilation or compilation to native code), and I have seen, though
not used in anger, interpreted C environments (from which interpreted
C++ is only a fairly small step).

> >Scripting languages tend to be less efficient than system programming
> >languages, in part because they use interpreters instead of compilers
> >but also because their basic components are chosen for power and ease
> >of use rather than an efficient mapping onto the underlying
> >hardware. For example, scripting languages tend to use variable-length
> >strings in situations where a system programming language would use a
> >binary value that fits in a single machine word, and scripting
> >languages often use hash tables where system programming languages use
> >indexed arrays.
> 
> But why? If we accept that scsh is a scripting language (which clearly
> it is), it suffers from neither of these drawbacks.

Neither, strictly, does Perl or Tcl8.  Your straw^H^H^H^H^Hpoint?

> >Fortunately, the performance of a scripting language isn't usually a
> >major issue. Applications for scripting languages are generally
> >smaller than applications for system programming languages, and the
> >performance of a scripting application tends to be dominated by the
> >performance of the components, which are typically implemented in a
> >system programming language.
> 
> This is an often put forward argument that falls over time and time
> again when reality hits. Applications might start off small, but then
> people want more features, more performance, more
> everything. Eventually using the poor scripting languages break down
> because they don't give you the performance or data structures or
> abstraction mechanisms to support what you're doing. Things become
> more and more messy. You keep having to go back and rewrite things in
> your "systems" languages.

Not in my experience.  Speed usually depends on two factors, the
algorithms, and the quantity of interaction with the external world
(particularly users or network resources).  The implementation
language itself (in the hands of the skilled) tends not to make too
big a difference.

> Sure Tcl and C can be a lot faster than C alone. But then C is an
> appalling benchmark against which to make judgements.

Suggest a better one.  Give concrete examples please (bearing in mind
"horses for courses" - languages, whether scripting or otherwise, tend
to be better at the areas that they were designed for, and I don't
think that anything is a solution for everything)

> At this stage the argument gets to the utterly riduclous
> stage. According to Ousterhout, because Scheme has only 5 "primitive"
> operations which execute only a few instructions, therefore to do
> anything in Scheme must be orders of magnitude more verbose than in
> Tcl which has lots of primitive operations. NOT!

JO's whole article doesn't mention Scheme (or Lisp or functional
programming) once.  I checked.  Try consuming less hallucinogens, or
at least give a reference.

> The convenience of performing complicated tasks is partly because of
> the elegance of the language, but mostly has a lot to do with the
> design of the libraries it has associated with it. Naturally Tcl can
> do a lot of things with a few lines of code, because it is supported
> by truckloads of library code doing the real work. But that is a
> benefit of Tk. Not Tcl.

Tcl was _always_ designed to be used with extension libraries, and it
goes out of its way to make things easy for them.  That, together with
its regularity (it takes a couple of pages to describe Tcl.
Everything else, including control constructs like for and while,
belongs in libraries,) is what makes the language so good.

> - There is no mention about whether the "systems" language
> implementation used an extensive set of libraries such as that which
> comes with Tcl, or whether they decided to reinvent every wheel
> themselves, as so often happens on C and C++ projects.

Probably using Motif... :^)

> Here is the problem with scripting languages. Most applications start
> off with a simple model and structure, a modest sized dataset, and a
> well-defined problem. But then guess what? People want more features
> leading to more complex algorithms and the need for data
> structures. People start to feed larger and larger datasets into the
> program. And the requirements of the program start to change and
> change. Then you have to start all over from scratch because you find
> that Tcl doesn't scale.

An unfounded assertion.  Please provide proof (in the face of a number
of very large commercial projects written in Tcl)

[ elided ]
> Oh really?? Scripting languages are simpler and easier to learn than
> systems languages? That is a very broad claim to make. It is also a
> lot of rot. Take perl for example. A difficult language to truely
> understand and master. Each language has it's own unique
> characteristics and difficulties. It has nothing to do with whether it
> is a supposedly "systems" or "scripting" language.

It depends what your background is.  For people with lots of shell,
sed, awk and C experience, perl is quite easy.  It all depends on your
background.

> >For example, compare Visual
> >Basic with Visual C++; few casual programmers would attempt to use
> >Visual C++, but many have been able to build useful applications with
> >Visual Basic.
> 
> Yeah right. Use C++ as a comparison against BASIC. Why not compare
> Perl to Scheme? Who wins then?

OK.  Why not perform that comparison in the area of CGI programming
with a web server running on NT?  Who wins then?

> >Unfortunately, there is not much evidence that object-oriented
> >programming produces the benefits claimed for it. Some projects have
> >claimed success with object-oriented languages, but others have
> >reported that languages like C++ actually made software management
> >problems worse. 
> 
> So object oriented technology is condemned because of the failure of
> C++? Yeah right.

OOTech is good - it is just OOProgramming that seems to have come
unstuck.  Analysing and designing using OO techniques is still a
really good idea.

Oops! I've got to catch a train.  The rest of your message is just as
irritating though (especially the few hundred blank lines at the end :^)

Donal.
--
Donal K. Fellows   http://r8h.cs.man.ac.uk:8000/  (SAY NO TO COMMERCIAL SPAMS!)
(work) fellowsd@cs.man.ac.uk     Dept. Comp. Sci, Univ. Manchester, U.K.
 |     donal@ugglan.demon.co.uk  6,Randall Place, Heaton, Bradford, U.K. (home)
 +-> ++44-161-275-6137  Send correspondence to my office  ++44-1274-401017 <-+


------------------------------

Date: Fri, 04 Apr 1997 11:15:32 -0500
From: Joel Friedman <joelf@volpesys.com>
To: Dico Reyers <dico@peionline.com>
Subject: Re: PERL 5.0 on Windows 95...
Message-Id: <33452924.34E4@volpesys.com>

Have you tried: www.perl.hip.com

Perl for Win32 was ported by hip communications inc. and they are
currently beta testing 5.003.

Joel (joelf@volpesys.com)


------------------------------

Date: Fri, 04 Apr 1997 11:16:00 -0500
From: Joel Friedman <joelf@volpesys.com>
To: Dico Reyers <dico@peionline.com>
Subject: Re: PERL 5.0 on Windows 95...
Message-Id: <33452940.12B8@volpesys.com>

Dico Reyers wrote:
> 
> Hello...
> 
> I have been online testing my perl scrpts on a unix system.  Every
> time I want to test a script for a web page I log on upload the file
> and test it out.
> 
> Where can I get PERL 5.0 for win95?  Is it easy to install?
> 
> Any help would be greatly appreciated.
> 
> Dico Reyers
> 
> dico@peionline.com

Have you tried: www.perl.hip.com

Perl for Win32 was ported by hip communications inc. and they are
currently beta testing 5.003.

Joel (joelf@volpesys.com)


------------------------------

Date: 4 Apr 1997 15:21:00 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: PERLscript with URL redirection
Message-Id: <5i368s$7jl@fridge-nf0.shore.net>

Donovan Janus (donovan@zaak.nl) wrote:

: Perl definitely understand the HTTP/1.0 302 Object Moved code.

Since when?  Please enlighten me.

: You need this code if you are using Microsoft Information Server.
: Otherwise you should be just fine with Location: $url

As much as you think it's Perl, I think it's a server requirement.  Unless
someone has placed these things (dreadfully, doubtfully) in NTPerl, I
disagree.

You might want to read up on the server stuff at http://hoohoo.ncsa.uiuc.edu
and http://www.w3.org .

--
Nathan V. Patwardhan
nvp@shore.net



------------------------------

Date: 4 Apr 1997 10:22:47 -0500
From: "Alestair B. Niere" <niere@ntep.nec.co.jp>
To: comp.lang.perl.misc@myriad.alias.net
Subject: problem with file handling in perl
Message-Id: <3344C238.4783@ntep.nec.co.jp>

Hello,

   I am studying perl for a week now.
   I made this simple CGI script but once this script is executed by
   clicking the submit button, Netscape generates an error.

      Netscape Error: Document contains no data

Here is the script:

---------- start of code ---------

#!/usr/local/bin/perl -w

$data = $ENV{"QUERY_STRING"};
$data =~ tr/+/ /;                               
$data =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

@keyval = split( /&/, $data );                  
$count = 0;
$file = "/share4/home/niere/.www/cgi-bin/bug.data";

print "Content-type: text/html\n\n";

if ( -e "$file" ){
  open( FIL, ">>$file" ) or die "Unable to open $file\n";
}
else{
  open( FIL, ">$file" ) or die "Unable to open $file\n";
}

while ( $keyval[$count] ne "" ) {
  ($key,$value) = split(/=/, $keyval[$count]);  
  $hash{$key} = $value;                         
  $count++;
}

$count = 1;
foreach $keys ( %hash ){
  print FIL "<i>$keys  $hash{$keys}</i><br>" unless ( $count%2 == 0 );
  $count++;
}

close( FIL );

------- end of code ---------

  I tried to comment out those file manipulation routines and print
  the output to STDOUT then it works fine.
  What is lacking with this code.

  Thanks in advance

-- 
                                 - TROY -
-----------------------------------
Alestair "Troy" B. Niere
6015 Lapu-lapu City
Cebu, Philippines            
mailto:niere@ntep.nec.co.jp
-----------------------------------


------------------------------

Date: 4 Apr 1997 14:56:21 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Problems with objects (Odd Number of elem. in hash list)
Message-Id: <5i34ql$r4l@pirate.shu.edu>

Hello -

Luca Passani <lpa@sysdeco.no> writes:

>Hallo,

> I'm delving into the OO features of Perl5 and I'm bumpinng my head
>against this strange error.

>"Odd number of elements in hash list at Dialogsys.pm"

># Dialog constructor
>sub new {
>    my $name_or_ob = shift; #name of the class or reference to object
>    my $class = ref{$name_or_ob} ||  $name_or_ob;

Change that to:

	my $class = ref($name_or_ob) || $name_or_ob;

(parens instead of braces)

Otherwise you're creating a reference to an anonymous hash with
one member (an odd number, and - well, you get the idea :-)


David Black
dblack@icarus.shu.edu



------------------------------

Date: Fri, 04 Apr 1997 15:11:14 +0000
From: aulamac <aulamac@univ.it>
Subject: Re: Replacing text
Message-Id: <33451A12.6F01@univ.it>

When you write:
								@array[$i]
I think you mean:
								$array[$i]
See the perlfaq4.

Gabriel.


------------------------------

Date: 4 Apr 1997 15:21:34 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Replacing text
Message-Id: <5i369u$6s@pirate.shu.edu>

Hello -

"Stephen Hill" <scs@huron.net> writes:

>I have written a script that searches a database and then prints out the
>search results. I want the words that were used for the search to be
>printed it red. The portion of script below does it, with one PROBLEM. 

>If @keywords has one item in it, when the results are printed, the one
>keyword that was searched on does not appear!?!
>if @keywords has two items, the first word appears in red and the other is
>missing
>if @keywords has three items......1 & 2 show up and the 3rd is missing
>if @keywords has four itmes they ALL appear!!!



>@lines[$i] =~ s/@keywords[0]/<FONT COLOR=\"FF0000\">@keywords[0]<\/FONT>/i;
>@lines[$i] =~ s/@keywords[1]/<FONT COLOR=\"FF0000\">@keywords[1]<\/FONT>/i;
>@lines[$i] =~ s/@keywords[2]/<FONT COLOR=\"FF0000\">@keywords[2]<\/FONT>/i;
>@lines[$i] =~ s/@keywords[3]/<FONT COLOR=\"FF0000\">@keywords[3]<\/FONT>/i;
>        

>@item = split(/\t/,@lines[$i]);
>print "<I>Order Number:</I><B>@item[0]</B><BR>";
>print "<I>Item:</I> <B>@item[1]</B><BR>";
>print "<I>Medium:</I> <B>@item[3]</B><BR>";
>print "<I>Company:</I> <B>@item[4]</B><BR>";
>print "<I>Retail:</I> <B>\$@item[8]</B><BR><HR>\n";

Everything that you've written with this syntax:

@list[$scalar]  or  @list[integer]

should be written with this syntax:

$list[$scalar]  or  $list[integer]

To be honest, I can't see my way past all of that to analyze the
underlying/further problem.  Could you clean it up, retry it,
and re-report?

David Black
dblack@icarus.shu.edu



------------------------------

Date: Fri, 04 Apr 1997 16:44:00 GMT
From: yu106779@yorku.ca (Alex Chernyavsky)
Subject: submitting from another frame
Message-Id: <5i3b3v$bpe$3@sunburst.ccs.yorku.ca>


Is there any way, that the following can be done:

After pressing submit button in the parent frame, only the form variables of 
the child frame will go to script.

Any help will be appreciated.


------------------------------

Date: Fri, 04 Apr 1997 09:32:12 -0600
From: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
Subject: symbolic reference doesn't work with arrays?
Message-Id: <33451EFC.41C6@lmtas.lmco.com>

I am trying to use a symbolic reference to change array elements
as follows:

  my @one = ('a');
     @two = ('b'); # <============ Note: no "my"

  print "before: $one[0], $two[0]\n";

  $name     = "one";
  $$name[0] = 'A';

  $name     = "two";
  $$name[0] = 'B';

  print "after:  $one[0], $two[0]\n";

In perl 5.003, on IRIX 6.2, this prints out:

  before: a, b
  after:  a, B

The second line should be "after:  A, B".

Why should declaring the @one array with "my" prevent the symbolic 
reference from working properly?  Is this a bug, or am I using the 
"my" declaration or the symbolic reference improperly?

Thanks,
Brett

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brett Denner                                        Lockheed Martin TAS
Brett.W.Denner@lmtas.lmco.com                       P.O. Box
748            
(817) 935-1142 (voice)                              Fort Worth, TX 76101
(817) 935-1212 (fax)                                MZ 9333


------------------------------

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 234
*************************************

home help back first fref pref prev next nref lref last post