[18982] in Perl-Users-Digest
Perl-Users Digest, Issue: 1177 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 22 14:05:38 2001
Date: Fri, 22 Jun 2001 11:05:10 -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: <993233110-v10-i1177@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 22 Jun 2001 Volume: 10 Number: 1177
Today's topics:
Can't get output into a file <giddeyup@derby.com>
Re: Can't get output into a file <pne-news-20010622@newton.digitalspace.net>
Re: Can't get output into a file <ren@tivoli.com>
Converting COBOL numbers <EUSWMCL@am1.ericsson.se>
help with mod_perl enabled "contact us" pages (for a we <ryan@don't.think.about.it.com>
Re: help with mod_perl enabled "contact us" pages (for <ryan@don't.think.about.it.com>
Re: How do I use module if I don't have the permission <jason@uklinux.net>
Re: how does one go about assigning the ip address from (Vorxion)
Re: libwww in Standard Distro? (was: Re: Grabbing a web <jason@uklinux.net>
newbie: sendmail based on array of addresses <mhunt5@hotmail.com>
Re: newbie: sendmail based on array of addresses <jason@uklinux.net>
Re: one liner ... simple question <Allan@due.net>
Re: one liner ... simple question <pne-news-20010622@newton.digitalspace.net>
Re: one liner ... simple question <pne-news-20010622@newton.digitalspace.net>
Re: one liner ... simple question <Allan@due.net>
parsing perl to create list of undefined subroutines (Sweth Chandramouli)
Re: parsing perl to create list of undefined subroutine (Sweth Chandramouli)
Re: Perl description <ccespede@anakena.dcc.uchile.cl>
Re: Perl description <gnarinn@hotmail.com>
Re: Perl description <ccespede@anakena.dcc.uchile.cl>
Possible to split GIF or JPG into 12 images? (Marc Bissonnette)
Re: Uninitialized Value from a Hash? nobull@mail.com
Re: Why is perl faster then Tcl <usenet.2001-06-22@bagley.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 22 Jun 2001 08:38:48 -0700
From: "Mr. Ed" <giddeyup@derby.com>
Subject: Can't get output into a file
Message-Id: <tj6pegjq5u0k5d@corp.supernews.com>
I need to take filenames from this short script and put the filenames in
between the a href tags into an html page. The script doesnt do anything and
doesnt point to any errors. Wondering what I'm doing wrong:
opendir THISDIR, "." or die "FATAL Problem with opening directory: $!";
@allfiles = readdir THISDIR;
$hallwayname=join '',">","hallwaylist.html";
$headels = '<html><head><META NAME="ROBOTS"
CONTENT="INDEX,FOLLOW"></head><body>';
$ourfriends='<a href="http://www.matrix.com/ourfriends.html"><img
src="transbg.gif" width=1 height=1 border="0"></a>';
$ourfriends2='<a
href="http://www.matrix.com/ourfriends.html">ourfriends</a><br>';
$closeels = '</body></html>';
open(OUTHALL,$hallwayname) ;
print OUTHALL ("$headels\n");
print OUTHALL ("$ourfriends\n");
foreach $allfiles (@allfiles){
print OUTHALL ('<a href="http://www.client.com/');
print OUTHALL ($allfiles);
print OUTHALL ('"><img src="transbg.gif"></a>/n');
print OUTHALL ($closeels);
close THISDIR;
}
any help appreciated
Thanks
Ed
------------------------------
Date: Fri, 22 Jun 2001 17:49:35 +0200
From: Philip Newton <pne-news-20010622@newton.digitalspace.net>
Subject: Re: Can't get output into a file
Message-Id: <p3q6jtsrnp5fovprn6d48fuhse54d8dihm@4ax.com>
On Fri, 22 Jun 2001 08:38:48 -0700, "Mr. Ed" <giddeyup@derby.com> wrote:
> I need to take filenames from this short script and put the filenames in
> between the a href tags into an html page. The script doesnt do anything and
> doesnt point to any errors. Wondering what I'm doing wrong:
[snip]
> open(OUTHALL,$hallwayname) ;
You're not checking your open.
> print OUTHALL ("$headels\n");
> print OUTHALL ("$ourfriends\n");
> foreach $allfiles (@allfiles){
> print OUTHALL ('<a href="http://www.client.com/');
> print OUTHALL ($allfiles);
> print OUTHALL ('"><img src="transbg.gif"></a>/n');
Your indenting does not reflect the code structure, making it difficult
to see what is going on.
You use '/n' when you might mean "\n" instead.
> print OUTHALL ($closeels);
You print '</body></html>' after every link, even though it should
probably only be printed at the end of the file.
> close THISDIR;
You close the directory with close() instead of closedir(), and you do
it once for every file found rather than after you're done with it
(after the readdir, in this case).
> }
You don't explicitly close the file you opened for writing and check the
return value of that close (for 'disk full' or similar errors).
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 22 Jun 2001 11:48:19 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Can't get output into a file
Message-Id: <m31yocbgvg.fsf@dhcp9-173.support.tivoli.com>
On Fri, 22 Jun 2001, giddeyup@derby.com wrote:
> I need to take filenames from this short script and put the
> filenames in between the a href tags into an html page. The script
> doesnt do anything and doesnt point to any errors. Wondering what
> I'm doing wrong:
You really should consider including:
use strict;
use warnings;
at the top of all of your scripts. It will save you headaches in the
long run.
> opendir THISDIR, "." or die "FATAL Problem with opening directory: $!";
> @allfiles = readdir THISDIR;
> $hallwayname=join '',">","hallwaylist.html";
Not a problem, but this could simply be:
$hallwayname = ">hallwaylist.html";
though see below for an additional comment on this.
> $headels = '<html><head><META NAME="ROBOTS"
> CONTENT="INDEX,FOLLOW"></head><body>';
> $ourfriends='<a href="http://www.matrix.com/ourfriends.html"><img
> src="transbg.gif" width=1 height=1 border="0"></a>';
> $ourfriends2='<a
> href="http://www.matrix.com/ourfriends.html">ourfriends</a><br>';
> $closeels = '</body></html>';
> open(OUTHALL,$hallwayname) ;
You need to check for the success of this open call. In all
likelihood, it is failing silently:
open OUTHALL, $hallwayname
or die "FATAL Problem with open $hallwayname: $!";
Also, I personally find it a little disconcerting to put the open mode
inside the variable. I would prefer setting $hallwayname to just
"hallwaylist.html" and then using:
open OUTHALL, ">", $hallwayname
or die "FATAL Problem creating $hallwayname: $!";
Note that this three argument version of open doesn't work on
sufficiently old versions of Perl.
> print OUTHALL ("$headels\n");
> print OUTHALL ("$ourfriends\n");
> foreach $allfiles (@allfiles){
> print OUTHALL ('<a href="http://www.client.com/');
> print OUTHALL ($allfiles);
> print OUTHALL ('"><img src="transbg.gif"></a>/n');
Is that "/n" supposed to be a "\n"? If so, it isn't going to expand
inside single quotes. You might want to explore using the qq//
operator for quoting HTML:
print OUTHALL qq(<a href="http://www.client.com/$allfiles">);
print OUTHALL qq(<img src="transbg.gif"></a>\n);
or even better, a HERE-doc:
print OUTHALL <<EOD;
<a href="http://www.client.com/$allfiles"><img src="transbg.gif"></a>
EOD
You're also apparently missing a close brace for the foreach loop. I
expect it goes here.
}
> print OUTHALL ($closeels);
> close THISDIR;
> }
One final note: you aren't running into this problem in this code,
but you should watch out for it. The problem is that you are using
the return values from openddir without including the path. In this
case, the path was simply ".", so that isn't a problem, but it is
something to watch out for.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Fri, 22 Jun 2001 11:03:57 -0400
From: William Cardwell <EUSWMCL@am1.ericsson.se>
Subject: Converting COBOL numbers
Message-Id: <3B335E5D.334112C8@am1.ericsson.se>
Hello,
I have 10 character strings like the list below representing dollar
amounts. I think they are some COBOL form such as "high punch" values,
but maybe not.
I tried all the unpack templates, and I would like not to have to load
special packages because so far I use binary perl on Win32 and VMS.
Any ideas as to what could be intended here and how to convert?
Thanks.
Will Cardwell
000014364{
000001026A
000002760A
000001620A
000011160A
000001026A
000000744A
000003810A
000000732A
000015052A
000010560A
000006435A
000000360A
000013759E
000011160A
000001980A
000002472F
000001819A
000007440A
000014560A
000000700A
000000640A
000002910A
000000340A
------------------------------
Date: Fri, 22 Jun 2001 11:27:30 -0400
From: "Ryan Covert" <ryan@don't.think.about.it.com>
Subject: help with mod_perl enabled "contact us" pages (for a web site)
Message-Id: <ErJY6.3120$Hq2.29903971@radon.golden.net>
Hi guys,
I'm busy working away on a company web site and I've come to the "Contact
Us" part of the project which involves filling out a form and having the
server e-mail the form data to a specific e-mail address. My problem is
that I cannot find any examples of how to do this in Perl.
I've visited Randal's WebTechniques Column where he has a few examples of
servers sending data requests between eachother through e-mail, but I can't
seem to get those examples to jive with my simple problem.
Could someone point me in the right direction (and maybe even towards an
example?) so that I can maybe get some actual form data to start sending
properly? :)
Thank you for your time.
Ryan
--
Ryan Covert
Punch Integrated Communications
Ph: (519) 826-9700 x235
Fx: (519) 826-9614
------------------------------
Date: Fri, 22 Jun 2001 11:42:35 -0400
From: "Ryan Covert" <ryan@don't.think.about.it.com>
Subject: Re: help with mod_perl enabled "contact us" pages (for a web site)
Message-Id: <TFJY6.3121$kh2.29835390@radon.golden.net>
I forgot to mention that I'm running this on a RedHat linux-based server
with mod_perl 1.25 and Apache 1.3.20 installed. :) So I assume I need to
interface with sendmail somehow to get the e-mail sent....
--
Ryan Covert
Punch Integrated Communications
Ph: (519) 826-9700 x235
Fx: (519) 826-9614
"Ryan Covert" <ryan@don't.think.about.it.com> wrote in message
news:ErJY6.3120$Hq2.29903971@radon.golden.net...
> Hi guys,
>
> I'm busy working away on a company web site and I've come to the "Contact
> Us" part of the project which involves filling out a form and having the
> server e-mail the form data to a specific e-mail address. My problem is
> that I cannot find any examples of how to do this in Perl.
>
> I've visited Randal's WebTechniques Column where he has a few examples of
> servers sending data requests between eachother through e-mail, but I
can't
> seem to get those examples to jive with my simple problem.
>
> Could someone point me in the right direction (and maybe even towards an
> example?) so that I can maybe get some actual form data to start sending
> properly? :)
>
> Thank you for your time.
>
> Ryan
>
> --
> Ryan Covert
> Punch Integrated Communications
> Ph: (519) 826-9700 x235
> Fx: (519) 826-9614
>
>
------------------------------
Date: Fri, 22 Jun 2001 16:20:07 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: How do I use module if I don't have the permission to install?
Message-Id: <Pine.LNX.4.30.0106221618530.27738-100000@s1.uklinux.net>
On 22 Jun 2001, chih-chieh, Huang wrote:
> I don't have the permission to install the module I need on the server I use.
> And, it's not possible the administrator will give me that permission.
>
> If there any possibility that I can still use module which is not currently
> installed?
If you are not authorised to install software onto the system then be very
careful about whether you decide to do so.
In many places it is now a criminal offence to install software onto a
computer that you are not authorised to install the software onto.
Maybe the most suitable solution would be to host the script(s) elsewhere.
Jason
------------------------------
Date: 22 Jun 2001 13:21:02 -0400
From: vorxion@fairlite.com (Vorxion)
Subject: Re: how does one go about assigning the ip address from gethostbyname to variable...
Message-Id: <3b337e7e$1_2@news.iglou.com>
On Thu, 21 Jun 2001 20:48:09 GMT, Bart Lateur <bart.lateur@skynet.be> cogitated:
>Bart Lateur wrote:
>
>>Lincoln L Steins book is really goo. "Network Programming with Perl".
>
>A book for 5 year olds! Slime, yeah!
>
>Of course, it's a "good" book. No goo involved. Not that I know of,
>anyway.
What do you think holds the binding together? :)
--
Vorxion - Member of The Vortexa Elite
------------------------------
Date: Fri, 22 Jun 2001 16:22:43 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: libwww in Standard Distro? (was: Re: Grabbing a web page?)
Message-Id: <Pine.LNX.4.30.0106221620510.27738-100000@s1.uklinux.net>
On Fri, 22 Jun 2001, Tim Schmelter wrote:
> > Probably the LWP::Simple module. Grab libwww from CPAN to install it (if
> > you don't have it already).
>
> Which begs the question, "Why isn't libwww included as part of the standard
> Perl distribution?" It seems like a tremendously useful and heavily used set
> of utilities.
Because while perl is a very good language for writing CGI in that is not
it's only or even primary raison d'etre.
Having a simple basic core distribution with lots of easy to use
extensions is a far better way of distributing something like perl that is
used by so many different people for so many different tasks.
I think most of my perl scripts are non CGI even though I use perl for all
my own CGI projects.
Jason
------------------------------
Date: Fri, 22 Jun 2001 11:18:13 -0500
From: "Marshall Hunt" <mhunt5@hotmail.com>
Subject: newbie: sendmail based on array of addresses
Message-Id: <9gvrgs$r1c$1@slb7.atl.mindspring.net>
I've been handed some perl code, and I have an urgent need. I am receiving
variables from an HTML form and based on what I receive in one of those form
variables, I need to sendmail to a particular email address. Can anyone
show me basically how I would do this in Perl? Below is pseudocode for what
I need:
array email [ ][ ] =
{selection1, email1@it.com,
selection2, email2@it.com,
selection3, email3@it.com,
selection4, email4@it.com};
if (item == selection1)
sendmail to email1@it.com;
else if (item == selection2)
sendmail to email2@it.com;
else if (item == selection3);
sendmail to email3@it.com
else if (item == selection4);
sendmail to email4@it.com
else
sendmail to default@it.com
This is urgent, any help is appreciated.
TIA
------------------------------
Date: Fri, 22 Jun 2001 17:43:20 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: newbie: sendmail based on array of addresses
Message-Id: <Pine.LNX.4.30.0106221731510.4515-100000@s1.uklinux.net>
On Fri, 22 Jun 2001, Marshall Hunt wrote:
> I've been handed some perl code, and I have an urgent need. I am receiving
> variables from an HTML form and based on what I receive in one of those form
> variables, I need to sendmail to a particular email address. Can anyone
> show me basically how I would do this in Perl? Below is pseudocode for what
> I need:
>
> array email [ ][ ] =
> {selection1, email1@it.com,
> selection2, email2@it.com,
> selection3, email3@it.com,
> selection4, email4@it.com};
Have you ever heard of a hash?
my %selection;
$selection{1}=email1@it.com;
$selection{2}=email2@it.com;
my $item = param('item');
# You really should check that the value in item is valid data using a
# regex at this point.
if ( ! defined($selection{$item}) )
{
$emailaddress = "default\@it.com";
}
else
{
if (! validate($selection{$item}) # you need to write a sub to
# validate the value in $selection{$item}
{
# not valid data
$emailaddress = "default\@it.com";
}
$emailaddress = $selection{$item};
}
# and then on you go to use your prefered method to send the email on.
Jason
------------------------------
Date: Fri, 22 Jun 2001 11:16:14 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: one liner ... simple question
Message-Id: <9gvnfv$ldo$1@slb6.atl.mindspring.net>
"Walter Hafner" <hafner-usenet@ze.tu-muenchen.de> wrote in message
news:srjwv64mw7o.fsf@w3proj1.ze.tu-muenchen.de...
> Hello,
> just a quick check to confirm that I'm on the right path. :-)
> I want to convert a list to a hash, so that all the list values become
> keys in the hash.
> background: I want to do things like
> if ($a{$x}) {...}
> which I can't do with a list.
Well, it is kind of hard to tell from your example but you probably could.
> Currently I use:
> map {$a{$_} = 1} @b;
> with @b being the list and %a the generated hash.
> Any other way of doing this? (Of course there ist - we're talking about
> Perl here :-)
Hey, its Perl so TIMTOWTDI must be true:
You can use a hash slice so one other way:
@a{@b} = split('',1 x @b);
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
If a man does not keep pace with his companions, perhaps it is because he
hears a different drummer. Let him step to the music which he hears, however
measured or far away.
- Thoreau
------------------------------
Date: Fri, 22 Jun 2001 17:25:13 +0200
From: Philip Newton <pne-news-20010622@newton.digitalspace.net>
Subject: Re: one liner ... simple question
Message-Id: <fno6jt8kbchoetjprc8pkbruqj3miosg0g@4ax.com>
On 22 Jun 2001 16:21:31 +0200, Walter Hafner
<hafner-usenet@ze.tu-muenchen.de> wrote:
> I want to convert a list to a hash, so that all the list values become
> keys in the hash.
If you don't care about definedness of the hash's values, the quickes
way is probably
@hash{@list} = ();
> background: I want to do things like
> if ($a{$x}) {...}
> which I can't do with a list.
Ah; with the shortcut, you'd have to say "if (exists $a{$x})" since the
values will not be true (in the Perl sense).
> Currently I use:
>
> map {$a{$_} = 1} @b;
>
> with @b being the list and %a the generated hash.
Some people don't like using map in a void context :); to satisfy them,
you could re-write that as
$a{$_} = 1 for @b;
> Any other way of doing this? (Of course there ist - we're talking about
> Perl here :-)
@a{@b} = (1) x @b;
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Fri, 22 Jun 2001 17:25:48 +0200
From: Philip Newton <pne-news-20010622@newton.digitalspace.net>
Subject: Re: one liner ... simple question
Message-Id: <qqo6jtgsgnkcb3qgppt65tdlnqshu23aoj@4ax.com>
On Fri, 22 Jun 2001 11:16:14 -0400, "Allan M. Due" <Allan@due.net>
wrote:
> You can use a hash slice so one other way:
>
> @a{@b} = split('',1 x @b);
I prefer
@a{@b} = (1) x @b;
Remember, 'x' does things differently depending on whether its LHS has
parentheses around it or not.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Fri, 22 Jun 2001 11:39:49 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: one liner ... simple question
Message-Id: <9gvot6$afj$1@slb5.atl.mindspring.net>
"Philip Newton" <pne-news-20010622@newton.digitalspace.net> wrote in message
news:qqo6jtgsgnkcb3qgppt65tdlnqshu23aoj@4ax.com...
: On Fri, 22 Jun 2001 11:16:14 -0400, "Allan M. Due" <Allan@due.net>
: wrote:
:
: > You can use a hash slice so one other way:
: >
: > @a{@b} = split('',1 x @b);
:
: I prefer
:
: @a{@b} = (1) x @b;
I do too now that I see it. I thought there should be a bettwer way, thanks.
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
you can't just guess at things and expect them to work. this isn't sociology.
- brian d foy (in clpm)
------------------------------
Date: Fri, 22 Jun 2001 16:20:25 GMT
From: sweth+perl@gwu.edu (Sweth Chandramouli)
Subject: parsing perl to create list of undefined subroutines
Message-Id: <dfKY6.379$Ga.97900@news1.rdc1.md.home.com>
As I find myself progressing more and more steadily
from sysadmin into perl programmer, I'm also finding myself needing to
do a lot of the same programming tasks over and over again--and like a
good sysadmin I'm trying to figure out easy ways to automate them. I
often, for example, sketch out my programs first with lots of
placeholder subroutines that I want to later flesh out. I've been
using the following to grovel through those skeletons once I'm mostly
finished, and extract a unique list of subroutine names that I then
need to make sure that I complete:
#!/usr/local/bin/perl -w
use strict;
my %new_subs;
my $counter;
while (<ARGV>) {
chomp;
while (/\&([^\s;]+)/g) {
$new_subs{$1} or $new_subs{$1} = ++$counter;
};
while (/^sub ([^\s;]+) {/g) {
delete $new_subs{$1};
};
};
for my $new_sub (sort {$new_subs{$a} <=> $new_subs{$b}} keys %new_subs) {
print "\nsub $new_sub {\n 1;\n};\n";
};
__END__
. I can go to the end of my app in vi, do a
"!get_new_subs %", and have the skeletons for all of the placeholder subs
that I've used but not yet defined appended to the file. It isn't perfect,
obviously--there are lots of potential false positives (any text string
containing an & followed by text, for example) and false negatives
(dynamically generated subroutines don't get caught correctly)--and I'm
assuming that until Damian finishes rewriting Parse::RecDescent, it won't
be able to be. I'd appreciate any comments people might have on better
ways to accomplish this. (My knowledge of Emacs is limited to "^C^X", but
I've recently decided that learning LISP might be fun, so I'd be open to
any Emacs-centric solutions as well, so long as the suggestors would be
willing to explain them to a rank novice at Emacs.)
-- Sweth.
--
Sweth Chandramouli ; <sweth+perl@gwu.edu>
------------------------------
Date: Fri, 22 Jun 2001 16:45:47 GMT
From: sweth+perl@gwu.edu (Sweth Chandramouli)
Subject: Re: parsing perl to create list of undefined subroutines
Message-Id: <%CKY6.512$Ga.102955@news1.rdc1.md.home.com>
In article <dfKY6.379$Ga.97900@news1.rdc1.md.home.com>,
Sweth Chandramouli <sweth+perl@gwu.edu> wrote:
> . I can go to the end of my app in vi, do a
>"!get_new_subs %", and have the skeletons for all of the placeholder subs
>that I've used but not yet defined appended to the file. It isn't perfect,
>obviously--there are lots of potential false positives (any text string
>containing an & followed by text, for example) and false negatives
>(dynamically generated subroutines don't get caught correctly)
And, of course, it assumes that I use the &sub notation for all
calls. Ever since I've started using this script, though, I've been doing
that, so that isn't an issue.
-- Sweth, succumbing to an annoying need for completeness.
--
Sweth Chandramouli ; <sweth+perl@gwu.edu>
------------------------------
Date: 22 Jun 2001 15:21:43 GMT
From: Cristian Cespedes V <ccespede@anakena.dcc.uchile.cl>
Subject: Re: Perl description
Message-Id: <9gvnq7$alj$1@sunsite.dcc.uchile.cl>
yes, your right! my teacher want that and me too but i can't found the answers. Already try that URL but it doesn't help me...
thanx again!
> Cristian Cespedes V wrote:
>>
>> i need some help, does any body know the answer of this questions?
> [snip]
> I think your teacher wanted you to do your own homework. You can start
> your research at http://www.perl.com
> -mjc
------------------------------
Date: Fri, 22 Jun 2001 15:29:54 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Perl description
Message-Id: <993223794.104092308785766.gnarinn@hotmail.com>
In article <9guq0b$ig7$1@sunsite.dcc.uchile.cl>,
Cristian Cespedes V <ccespede@anakena.dcc.uchile.cl> wrote:
>Hi!
> i need some help, does any body know the answer of this questions?
>
>1. is perl strong typing? what kind of typing it has?
>
>2. perl has lazy or active evaluation?
>
>3. how is the variable binding (linking) in Perl?
>
>well, i hope you wil help me... please helpme!!!
>
Ok. To do this assignement, you need first to make sure you
undestand the questions. For example, do you know what strong typing is?
If not, look it up in your course material.
Now if you have understood that, you need to devise a simple test that
will show strong typing or lack of it. then make a similar test in
a) a language you know has strong typing
b) a language you know has not
After this you have material to make an excellent answer to Q1.
Similarly for Q2 and Q3.
Hope this helps.
gnari
------------------------------
Date: 22 Jun 2001 17:27:28 GMT
From: Cristian Cespedes V <ccespede@anakena.dcc.uchile.cl>
Subject: Re: Perl description
Message-Id: <9gvv60$sdq$1@sunsite.dcc.uchile.cl>
yes, i undestand the questions. I can suposse that Perl is weak typing (not strong typing) because i can compare it with strong typing languajes like ML, but the other 2 questions are a bit more dificult to aswer to me. Hoy can i test lazy evaluation and the kind of variable bindigs. I suppose that the languaje has dinamic linking because it is weak typing (sorry if this is not the exact word), for example, but how can i validate that and how can i found a official information about this.
(Thanx again)again
> Ok. To do this assignement, you need first to make sure you
> undestand the questions. For example, do you know what strong typing is?
> If not, look it up in your course material.
> Now if you have understood that, you need to devise a simple test that
> will show strong typing or lack of it. then make a similar test in
> a) a language you know has strong typing
> b) a language you know has not
> After this you have material to make an excellent answer to Q1.
> Similarly for Q2 and Q3.
> Hope this helps.
> gnari
------------------------------
Date: Fri, 22 Jun 2001 17:20:42 GMT
From: dragnet@internalysis.com (Marc Bissonnette)
Subject: Possible to split GIF or JPG into 12 images?
Message-Id: <Xns90C88863F1D96dragnetinternalysisc@207.35.177.135>
Hello all;
I am wondering if it is possible to use Perl to split an image into 9 (or
whatever number you wanted) separate images? I.e. if you had image.jpg
which was (apologies for bad ASCII art)
--------
| |
| 1.jpg|
| |
--------
to split it into:
-------------------
|1.jpg|2.jpg|3.jpg|
|-----|-----|-----|
|4.jpg|5.jpg|6.jpg|
|-----|-----|-----|
|7.jpg|8.jpg|9.jpg|
-------------------
TIA for suggestions or pointers to the proper FAQ/URL's
----------------------------
Marc Bissonnette
InternAlysis
Intelligence in Internet Communications
http://www.internalysis.com
------------------------------
Date: 22 Jun 2001 17:46:37 +0100
From: nobull@mail.com
Subject: Re: Uninitialized Value from a Hash?
Message-Id: <u91yoc5uoi.fsf@wcl-l.bham.ac.uk>
"Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com> writes:
> ... there are some fields in the database I get data from that
> are blank - how do make perl not give me an error when there is an
> uninitialized error?
> [Fri Jun 22 08:35:01 2001] miscv.cgi: Use of uninitialized value at
> line 114.
> while ( my ($field,$data) = each %$row)
> {
> line 114-> print $cgi->p("$field = $data");
> }
> }
Simply insert "no warnings 'uninitialized';" before line 114.
This will switch off just this warning just for that line (well until
the closing brace on the next line actually). Note: this acts
lexically, it does _not_ effect the generation of warnings within the
call to the CGI module.
This is a new feature as of 5.6. For details "perldoc perllexwarn".
Alternatively use brute force:
$data = '' unless defined $data;
If you can be sure $data will never be '0' you can also write this as:
$data ||= '';
> nobull@mail.com wrote:
[ snip uneceassry quote of the tail of my post complete with my BUAG sig]
Please quote only enough to minimally establish context and do so in
context not all at the start/end. If people need more context they
should be able to use the References header (which, incidently, your
post didn't have).
Please never quote sigs (unless of course you are commenting on the
sig).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 22 Jun 2001 10:49:24 -0500
From: Doug Bagley <usenet.2001-06-22@bagley.org>
Subject: Re: Why is perl faster then Tcl
Message-Id: <m3u218v7jv.fsf@ns.bagley.org>
claird@starbase.neosoft.com (Cameron Laird) writes:
> In article <3B2D938B.CB2D4C02@localhost.blorg>, <karl@localhost.blorg> wrote:
> >Q: Why is perl faster than tcl?
> .
> .
> .
> >> I'm doing a paper on Tcl and perl and I have an import
> >> quesition.
> >>
> >> Do you know why perl is so much faster then Tcl? I've
> .
> .
> .
> <URL: http://mini.net/tcl/1799.html > is slowly
> accreting material that bears on this question.
On that page, the following URL is referenced:
http://www.equi4.com/md5/
I have recently submitted a significantly faster version of the pure
Perl MD5 code. It doesn't look like it has been posted yet, but it
should put Perl ahead of the current Lua entry. The current code
there uses custom subs for encoding a string into a list of 32-bit
UINTs and back, whereas it should use pack/unpack. It also has a bug
in one place using the 2 argument version of substring, when it should
use the 3 argument version.
I expect that some of the other scripting languages on that page
could also be sped up a bit. The Python entry looks like a likely
candidate for optimization. The biggest problem with implementing
MD5 purely in a scripting language is that while the C version can
use lots of little functions, you'll want to inline some of them in
the scripting languages. I'm going to see if I can speed up some of
the other languages too.
I would advise everyone not to trust benchmarks, nor to be quick to
draw conclusions from them :-)
Cheers,
Doug
------------------------------
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 1177
***************************************