[16339] in Perl-Users-Digest
Perl-Users Digest, Issue: 3751 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 19 18:10:31 2000
Date: Wed, 19 Jul 2000 15:10:19 -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: <964044619-v9-i3751@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 19 Jul 2000 Volume: 9 Number: 3751
Today's topics:
Re: NEW: AI::NeuralNetwork - idea, comments <nospam@nospam.com>
Re: NEW: AI::NeuralNetwork - idea, comments <jdb@wcoil.com>
Re: NEW: AI::NeuralNetwork - idea, comments <jdb@wcoil.com>
Re: NEW: AI::NeuralNetwork - idea, comments <jdb@wcoil.com>
Re: NEW: AI::NeuralNetwork - idea, comments <godzilla@stomp.stomp.tokyo>
Re: NEW: AI::NeuralNetwork - idea, comments <godzilla@stomp.stomp.tokyo>
Re: Newbie Question - about calendars bornholtz@my-deja.com
Re: Newbie Question - about calendars <tbornholtz@cso.com>
Re: Newbie: Reading in file contents <dmeyers@panix.com>
NT .pl usage, Registry, ReadParse, Redirecting invinfo@my-deja.com
Re: Posting bug reports = mail spam?? <nospam@nospam.com>
Problem with Building some XS functions <zkessin@transam.admin.icoms.com>
Question on looping over input records bdesany@my-deja.com
Re: Question on looping over input records <care227@attglobal.net>
Re: Question on looping over input records <aqumsieh@hyperchip.com>
Re: Question on looping over input records (Cameron Kennedy)
Reading first MX (exchange record) <scrampton71NOscSPAM@hotmail.com.invalid>
reading from external files into variables <raphaelp@nr1webresource.com>
Saving space in a hash <russ_jones@rac.ray.com>
Re: Setting environment variables in Perl <mjcarman@home.com>
Use root from a CGI <irqjfl@hotmail.com>
Re: Use root from a CGI <johnv@rentals.com>
Re: Use root from a CGI <red_orc@my-deja.com>
variable cheching ? <e.bras@hccnet.nl>
Re: variable cheching ? (Cameron Kennedy)
Re: weird eval problem <jasonb885@my-deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 Jul 2000 18:18:58 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <8l4rei$iid$0@216.155.32.168>
In article
<Pine.GSO.4.21.0007190940100.2094-100000@mamba.cs.Virginia.EDU>, David
Coppit <newspost@coppit.org> wrote:
| On 19 Jul 2000, Ilmari Karonen wrote:
|
| > In article <8l3moa$7b2$1@nnrp1.deja.com>, peterhi@my-deja.com wrote:
| > >AI::NeuralNetwork::BackProp perhaps and then we can extend the base
| > >name
| >
| > That's not going to win a golf contest. Surely something shorter
| > would work just as well..
| >
| > AI::NeuralNet::BackProp?
| > AI::Neural::BackProp?
| > AI::Neural::BP?
|
| Please, NOOO! Most of the lifetime of software is spent in maintenance.
| That
| is, more people will be reading code that writing it. Make the little
| investment of typing the extra characters so that people later on will
| know
| what the heck you're talking about.
|
| David (who's tired trying to decipher variables with names like "x",
| "xx",
| "Decl", "Obstack", and "cov_lst".)
Agreed; surely the NAMING of a module space has nothing to do with perl
golf. :-P
However "AI::NeuralNet::BackProp" does seem appropriate, conveys the
proper imagery, and takes some of the work out of it :D *duck*
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 19 Jul 2000 18:43:20 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <8l4ss8$nlb$0@206.230.71.18>
> However "AI::NeuralNet::BackProp" does seem appropriate, conveys the
> proper imagery, and takes some of the work out of it :D *duck*
>
Point well taken! Thankyou for this bit of slapping around. I do enjoy
listening
to a friendly discussion rather than rude rantings in here, as is too often
to norm.
Thankyou! I think I shall change the name, as everyone seems to think would
be appropriate.
Now, I don't have much experience with neural-networks, or even AI, but I
am extreemly facinated by such work, so don't go hitting too hard when you
actually see the code! LOL... I'll respond more on this line in the thread
above
this.
Cheers!
~ Josiah
------------------------------
Date: 19 Jul 2000 18:47:27 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <8l4t3v$o5f$0@206.230.71.18>
Jakob Schmidt <sumus@aut.dk> wrote in message
news:wvijdqkd.fsf@macforce.sumus.dk...
> logan@cs.utexas.edu (Logan Shaw) writes:
>
> I'm a complete novice with regards to AI and neural networks but if I'm
not
> wrong the network model described in the original post is of the
> feedforward backpropagation type. If this is the only type of neural
network
> the module is able to simulate perhaps the name should be more specific.
Taken care of. I am changing the name to AI::NeuralNetwork::BackProp, for
all
of you who care. :-)
> Without aligning myself with Godzilla I'd also like to question the use of
> AI.
Goahead, Godzilla is quite ammuzing, and, more often than not, right on
target with the issues discussed.
> I believe that AI by convention is based on symbol manipulation. Neural
> networks provide one way of implementing such. But the pattern
classification
> achieved by the network model described in the OP is not actually an
example
> of AI as far as I know.
Ahh..what would it be an example of? I did not come up with another
namespace,
and it seemed to me in my humble learnings, that Neural networking is, at
times,
associated with the concpet of AI, at least in theory. Therefore, it seemed
appropriate
to put it in the AI namespace.
> Generally speaking, neural networks are not an AI concept though they may
be
> used in AI. Therefore placing them hierarchically under AI in the name
space
> might be misleading.
Or more organized....
Cheers!
~ josiah
------------------------------
Date: 19 Jul 2000 19:00:21 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <8l4ts5$qfd$0@206.230.71.18>
Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:3974F776.991A457C@stomp.stomp.tokyo...
> Yossi Mamroud of Tel-Aviv University maintains
> a decent a site page with an excellent list of
> sites related to this thread topic. You will
> find some links for neural networking.
>
> http://spinoza.tau.ac.il/hci/dep/philos/ai/links.html
- Very good site!
> This claim by the author of this module, his
> programming is based upon neural networking,
> causes me to raise a Vulcan skeptical eyebrow.
You are probably right. Yet tuhe only claim I make
in regards to this module is that it was yet another
amuzing module to write! I spent about 6 hours
reading some of Hopefields work, reading about
Dobbs rule and the Delta rule, and everything
else entailed with Back-prop, supervised, and
unsupervised learning, feed-foward and most
other things along that line.
Then, I put the papers aside, and began writing
from scratch a simple module to replicate the
idea of neural networking-- that is, multiple
pieces of independent functions, neurons, whatever..
working together, tied together, each built upon
the other in a network fashion to produce results
based upon input, with the capibility for
pseudo-self-modification. Ok, maybe I'm out
on a limb here or crazy...but the facination I
find here is the ability of a computer to self-
modify, to "learn", a correct response and apply
such to an application. This is the only claim
I make about this module, that it is based upon
the idea of being able to self-modify and "learn"
a response using individual "neurons" of code.
If this isn't neural networking, then I am sorry
for using the incorrect name. I am not in ANY
way trying to potray myself as a AI specialist
or neural-networking, or even a perl, expert.
I simply enjoy the challenges presented by
perl in general, and learning to program AI and
neural-networking in specific. I am sorry if
I lead anyone to believe diffrent. I simply
enjoy programming! I am not here to say
I know everything, just a little of something
here and there.
> This author of this module under discussion,
> has made a formal claim his technique will
> be able to categorize those sentences and
> formulate a correct response or, at least
> learn to provide a correct response. Spock
> would respond, "Fascinating." Kirk, well you
> know he would demand resolution answers and,
> eat an exotic green peach while awaiting.
I am sorry, I have made no formal claim about
such advanced abilities. This module, I hope,
will be able to learn a set of "patterns"
composed of numbers within a set range, range
set by a script author. Then once it has learned
multiple patterns, be able to run a completly
new pattern that it has never seen before. Upon
running it, I aim for it to be able to compare the new
pattern with stored patterns and deduct wich one
it matches closest with some margin of error set
by a script author.
> > I don't hope I'm all wrong here?
I am sorry...perhapse you could suggest a better
namespace? I did not mean to offend anyone by
such a name, and I desire to learn more as much
as I can about the _art_ of Aartificial Intelligence.
> Nonetheless, a final decision on this alleged
> module's name, is the author's sole propriety.
> It's his peach to eat.
Ahh..you are too kind. *chuckle*
As the wise man once said, " I don't hope I'm all wrong here? "
I do so look foward to replies on this! *chuckle again*
Cheers!
~ josiah
------------------------------
Date: Wed, 19 Jul 2000 12:43:39 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <397604EB.6B0D8D92@stomp.stomp.tokyo>
Josiah Bryan wrote:
> Godzilla! wrote:
(snipped with significant annoyance)
Two things. First is you are changing your
initially stated parameters of performance.
Changing parameters with each article response,
seems a customary tradition these days for Perl
related newsgroups.
My second concern is your deliberate misspelling
of names of those well recognized pioneers in
this field of Artificial Intelligence. This is
most insulting in terms of respect for others.
This does annoy me significantly.
So you spent a total of six hours or so researching
this field of neural networking and Artificial
Intelligence and, have written a module based
upon Hebb's / Delta style neural networking.
I can read your face well and your concealed
cards even better. There will be no need for
one of my infamous sleeve aces for this
card game of Go Fish.
If you wish to play high stakes poker with me,
learn how to play poker, learn this language
of illuminati poker, engage me with a decent
ante, then hope I don't fleece your brain's
bank account, which appears, in your specific
case, to be a little short on funds, if not
a tad bit overdrawn.
**
For another who believes this type of programming
can be accomplished successfully using Perl, this
is a graphic which well exemplifies claims of or
hints at neural networking with Perl, amount to
nothing greater than more mule manure being piled
higher upon this Mule Manure Mountain, a sweet
term of endearment I have coined for these Perl
newsgroups as a collective.
http://www.speech.kth.se/NICO/firstfig.gif
Godzilla!
------------------------------
Date: Wed, 19 Jul 2000 12:51:47 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <397606D3.C168FADE@stomp.stomp.tokyo>
Josiah Bryan wrote:
> Jakob Schmidt wrote:
> > logan wrote:
(snipped)
> > Without aligning myself with Godzilla I'd also like
> > to question the use of AI.
> Goahead, Godzilla is quite ammuzing, and, more often
> than not, right on target with the issues discussed.
A risk you take playing poker with me, is my tossing
out an ante you might rather not wish to match nor
have discussed, leading to your choice to fold.
Here is another link you may elect to research.
http://www.emsl.pnl.gov:2080/proj/neuron/neural/systems/shareware.html
Godzilla!
--
$godzilla = "godzilla rocks!";
srand(time() ^ ($$ + ($$ << 15)));
sub randcase
{ rand(40) < 20 ? "\u$1" : "\l$1" ; }
$godzilla =~ s/([a-z])/randcase($1)/gie;
print $godzilla; exit;
------------------------------
Date: Wed, 19 Jul 2000 20:17:30 GMT
From: bornholtz@my-deja.com
Subject: Re: Newbie Question - about calendars
Message-Id: <8l52cq$m1h$1@nnrp2.deja.com>
"Neil Lathwood" <laf@gameonline.co.uk> wrote:
> Hi Folks, I know this is being covered in a
different post but I have a bit
> of a different question.
>
> In my cgi script if I run:
>
> #!/usr/bin/perl
>
> print "content-type:text/html\n\n";
>
> @fini = `cal 12 2000`;
>
> print "@fini";
>
> it prints out the date's fine but what I want
to do is format the date into
> a table
Why bother shelling out to a different
application? It really isn't that hard to create
a calendar yourself. Here is some code that will
do it. (Standard disclaimer: I just whipped this
up since reading your message and as such it is
far from optimized and probably not totally bug
free)
#! /perl/bin/perl -w
use strict;
use CGI;
use Date::Calc qw(:all);
my $query = new CGI;
my @DayNames =
('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
my $Year = 1492;
my $Month = 1;
my $DOW = Day_of_Week($Year, $Month, 1);
my $Days = Days_in_Month($Year, $Month);
my @week;
my @blank = ();
my $CurrentDay = 1;
push @week, ' ' for ( 0 .. $DOW - 1);
for ($DOW .. 6) {
push @week, $CurrentDay;
$CurrentDay++;
}
print '<table border="1">';
print $query->Tr($query->th({colspan => 7},
[$Month . '/' . $Year]));
print $query->Tr($query->th(\@DayNames));
print $query->Tr($query->td(\@week));
while ($CurrentDay <= $Days ) {
@week = @blank;
for ( 0 .. 6 ) {
push @week, $CurrentDay;
$CurrentDay++;
last if($CurrentDay > $Days);
}
print $query->Tr($query->td(\@week));
}
print '</table>'
Good Luck, Hope this helps,
Tim Bornholtz
tbornholtz@cso.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 20:18:23 GMT
From: Tim Bornholtz <tbornholtz@cso.com>
Subject: Re: Newbie Question - about calendars
Message-Id: <8l52dr$8ac$1@nnrp1.deja.com>
"Neil Lathwood" <laf@gameonline.co.uk> wrote:
> Hi Folks, I know this is being covered in a different post but I have
a bit
> of a different question.
>
> In my cgi script if I run:
>
> #!/usr/bin/perl
>
> print "content-type:text/html\n\n";
>
> @fini = `cal 12 2000`;
>
> print "@fini";
>
> it prints out the date's fine but what I want to do is format the
date into
> a table
Why bother shelling out to a different application? It really isn't
that hard to create a calendar yourself. Here is some code that will
do it. (Standard disclaimer: I just whipped this up since reading your
message and as such it is far from optimized and probably not totally
bug free)
#! /perl/bin/perl -w
use strict;
use CGI;
use Date::Calc qw(:all);
my $query = new CGI;
my @DayNames = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
my $Year = 1492;
my $Month = 1;
my $DOW = Day_of_Week($Year, $Month, 1);
my $Days = Days_in_Month($Year, $Month);
my @week;
my @blank = ();
my $CurrentDay = 1;
push @week, ' ' for ( 0 .. $DOW - 1);
for ($DOW .. 6) {
push @week, $CurrentDay;
$CurrentDay++;
}
print '<table border="1">';
print $query->Tr($query->th({colspan => 7}, [$Month . '/' . $Year]));
print $query->Tr($query->th(\@DayNames));
print $query->Tr($query->td(\@week));
while ($CurrentDay <= $Days ) {
@week = @blank;
for ( 0 .. 6 ) {
push @week, $CurrentDay;
$CurrentDay++;
last if($CurrentDay > $Days);
}
print $query->Tr($query->td(\@week));
}
print '</table>'
Good Luck, Hope this helps,
Tim Bornholtz
tbornholtz@cso.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 19 Jul 2000 16:26:26 -0400
From: David Meyers <dmeyers@panix.com>
Subject: Re: Newbie: Reading in file contents
Message-Id: <yob7lah9899.fsf@panix3.panix.com>
"Bo" <bo@bo.com> writes:
> prakash_ojha@my-deja.com wrote in message
> >try this:
> >open (JOBS, "jobs.dat");
> >while($line = <JOBS>)
> >{ print $line; }
> Question : how are you advancing thru this loop?
> How is $line "incremented" ?
Read the docs. Or , pick up a copy of Learning Perl,
published by O'Reilly. This is _very_ basic Perl.
As far as the above code, that open should check
for success (ie. open (...) or die "error message:$!";)
and the reading in of the file, line by line, is via
the angle-brackets: <JOBS>
Seriously, though, while this may answer your question,
it's nowhere near enough. Read Learning Perl.
--d
------------------------------
Date: Wed, 19 Jul 2000 21:13:13 GMT
From: invinfo@my-deja.com
Subject: NT .pl usage, Registry, ReadParse, Redirecting
Message-Id: <8l55kl$b5u$1@nnrp1.deja.com>
I'm hoping for a quick answer and I have 4 brief questions here.
Environment: Windows NT 4.0 ActiveState Perl v5.6.0 and earlier.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm wondering what registry settings happen with (ActiveState perl).
I've seen some of the FAQ that tells about file association.
SET PATHEXT=.pl;%PATHEXT%
---------------------------------------
another Post showed
assoc .pl=Perl
ftype perl=C:\perl\bin\perl.exe "%1" %*
PATHEXT=...
---------------------------------------
For some reason, my system is associating Wordpad with .pl files,
even when I try to run them from the command line.
I do not see a FileType of .pl, PERL or anything similar in W's Explorer
Browsing through the registry, I didn't see anything obvious either.
How can I disassociate from WordPad ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What does ReadParse do ??? Here it is, out of the CGI.pm
# These are some tie() interfaces for compatibility
# with Steve Brenner's cgi-lib.pl routines
'ReadParse' => <<'END_OF_FUNC',
sub ReadParse {
local(*in);
if (@_) {
*in = $_[0];
} else {
my $pkg = caller();
*in=*{"${pkg}::in"};
}
tie(%in,CGI);
}
Obviously, it does globbing, but is there a dflt "in" variable ?????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have to also research redirecting, it works, but only inconsistenly.
I read about "perl2bat" and "perl2exe" but they did not seem to work
Anyone have more experience with this ?
Thanks in Advance for the suggestions
RJK (NAR)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 19 Jul 2000 19:14:05 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Posting bug reports = mail spam??
Message-Id: <8l4ult$r2b$0@216.155.32.168>
In article <3bRgOF$V0K@openbazaar.net>,
gellyfish@gellyfish.com.bbs@openbazaar.net (Jonathan Stowe) wrote:
| Quite honestly I know I do get spam but even relatively simple filters
| prevent me from actually seeing the vast majority of it. I wouldnt
| care to take a guess from where my address has been harvested though
| - and I have sent bug-reports to p5p.
Indeed. I have Outlook Express watching 5 e-mail addresses for me.. the
simplest SPAM filter I've devised is this:
Create a separate Folder inside Inbox for each e-mail address with
subfolders for mailing lists coming to that address.
Create a Filter that moves incoming mail addressed to that mailbox into
the respective folder.
Anything that remains in Inbox itself is 99% likely to be spam, as 100%
of the time, spam is 'hidden' via 'Bcc:' :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 19 Jul 2000 15:17:05 -0400
From: Zachary Kessin <zkessin@transam.admin.icoms.com>
Subject: Problem with Building some XS functions
Message-Id: <m37laiexqm.fsf@transam.admin.icoms.com>
I am having a problem. I am trying to write a perl front end to
some C code. I have created an xs file etc and it will load
etc. However I can't figure how how to do one thing. I have 1 function
which returns a pointer (void) which then has to be passed back to the
other functions in the library so that they know what data to use. Is
there any easy of having the xs layer hold onto this data without
passing it back to perl.
If anyone has any ideas on this please let me know. I've tried the
perlguts man page and the perlxs page etc and I'm kind of lost here.
Thanks.
--Zach
------------------------------
Date: Wed, 19 Jul 2000 18:07:19 GMT
From: bdesany@my-deja.com
Subject: Question on looping over input records
Message-Id: <8l4qoo$iqa$1@nnrp2.deja.com>
I am pretty much a newbie, but learning
quickly. I am confused about this behavior I
am seeing.
This code behaves as expected: it prints each
of the records:
$/ = "\n>";
open (READS, "$library.fa.n");
while (<READS>) {
print;
}
However, this code gives me an error about
an uninitialized variable for every iteration and
then after that prints out the match ($1) from
the first record:
$/ = "\n>";
open (READS, "$library.fa.n");
while (<READS>) {
m/(^>.{11})/;
print $1;
}
First, I don't understand why $_ (apparently)
doesn't change as the loop executes. Second,
I don't understand why $1 becomes undefined
as if the match is not being evaluated. Third, I
don't understand why all the errors print before
the match from the first record prints. Also, I
have tried using a named variable instead of
$_ and the same thing happens. What am I
missing?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 14:27:27 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Question on looping over input records
Message-Id: <3975F30F.5579E65D@attglobal.net>
bdesany@my-deja.com wrote:
>
> This code behaves as expected: it prints each
> of the records:
>
> $/ = "\n>";
> open (READS, "$library.fa.n");
> while (<READS>) {
> print;
> }
>
> However, this code gives me an error about
> an uninitialized variable for every iteration and
> then after that prints out the match ($1) from
> the first record:
>
> $/ = "\n>";
> open (READS, "$library.fa.n");
> while (<READS>) {
> m/(^>.{11})/;
> print $1;
> }
> First, I don't understand why $_ (apparently)
> doesn't change as the loop executes.
Are your records really seperated by a newline followed by a >?
Can you cut and paste the exact errors?
Can you post an example of your records?
------------------------------
Date: Wed, 19 Jul 2000 18:35:56 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Question on looping over input records
Message-Id: <7an1jehss2.fsf@merlin.hyperchip.com>
bdesany@my-deja.com writes:
> However, this code gives me an error about
> an uninitialized variable for every iteration and
> then after that prints out the match ($1) from
> the first record:
You'd better show us a test case of your input and output. You might be
misinterpreting what you're getting.
> $/ = "\n>";
> open (READS, "$library.fa.n");
> while (<READS>) {
> m/(^>.{11})/;
> print $1;
> }
>
> First, I don't understand why $_ (apparently)
> doesn't change as the loop executes.
What do you mean? At each iteration of the loop, $_ gets set to the next
available record in your file. Your first program showed that it works
as expected.
> Second,
> I don't understand why $1 becomes undefined
> as if the match is not being evaluated.
Maybe the match failed?
It's better to change your while() body to:
print $1 if /(^>.{11})/;
then you will print() only if the match succeeded.
> Third, I
> don't understand why all the errors print before
> the match from the first record prints.
I'm not sure, but it's probably due to buffering. Warnings get printed
on STDERR while your print() statement uses STDOUT.
> Also, I
> have tried using a named variable instead of
> $_ and the same thing happens. What am I
> missing?
Show us a small example of your input data, and we'll be able to help
you further.
--Ala
------------------------------
Date: Wed, 19 Jul 2000 11:48:43 -0800
From: kenned57@NoSpam.edu (Cameron Kennedy)
Subject: Re: Question on looping over input records
Message-Id: <kenned57-1907001148430001@alexthinkpad.salk.edu>
In article <8l4qoo$iqa$1@nnrp2.deja.com>, bdesany@my-deja.com wrote:
> I am pretty much a newbie, but learning
> quickly. I am confused about this behavior I
> am seeing.
>
> This code behaves as expected: it prints each
> of the records:
>
> $/ = "\n>";
> open (READS, "$library.fa.n");
or die"with a nice message";
> while (<READS>) {
> print;
> }
>
sets input record seperator to \n>
why ? is it really that hard to leave it at \n and deal with the > ?
Look at your m//, are you sure you want $/="\n>" That sort of implies your
data looks like
__DATA__
>>a bunch of stuff
>>even more stuff
>>la dee da dee da
> m/(^>.{11})/;
> print $1;
> }
>
m/(^>.{11})/; Hmmm.
So your seperating your records with "\n>"
and your looking for 11 characters after a > that starts a line.
i don't know what your data looks like, but this
seems wrong. Try not changing the $/ from it's default
state, you will probably see the result you want.
unless your data starts every line your interested in with
>>
Cameron
------------------------------
Date: Wed, 19 Jul 2000 12:04:47 -0700
From: steve cramton <scrampton71NOscSPAM@hotmail.com.invalid>
Subject: Reading first MX (exchange record)
Message-Id: <02dccd44.d674a17a@usw-ex0105-036.remarq.com>
This may seem like a silly question but given the example below,
how would I read only the first returned exchange record into
$mailhost.
After refering to the Perl docs, I have tryed various methods
but keep getting syntax error messages:
I'm new to perl.
Thanks,
use Net::DNS;
$name = "foo.com";
$res = new Net::DNS::Resolver;
@mx = mx($res, $name) ;
if (@mx) {
foreach $rr (@mx) {
print $rr->preference, " ", $rr->exchange, "\n";
}
}
else {
print "can't find MX records for $name: ", $res-
>errorstring, "\n";
}
$malhost = $name ;
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Wed, 19 Jul 2000 23:03:40 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: reading from external files into variables
Message-Id: <8l55cf$38g$13$1@news.t-online.com>
Hi,
I'm trying to make my script multi-language compatible and thought that I'd
extract all the text into one single text-file and have the script "import"
from it. I want the external file to contain information like following:
variable_name | Text, bla, bla,bla,bla,bla
varibale_name2 | Text. bla, bla, bla, bla
This is about how the layout of the library should be. Could anyone give any
starting aid?
Thanks in advance,
Raphael Pirker
------------------------------
Date: Wed, 19 Jul 2000 13:25:26 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Saving space in a hash
Message-Id: <3975F296.A02CD3CF@rac.ray.com>
Hiyez:
I'm building a hash that contains the same line of data, referenced
three different ways, like this:
$snmp{$ip} = $snmp_info;
$snmp{$dns} = $snmp_info;
$snmp{$alias} = $snmp_info;
(repeat for about five thousand different ip's)
So if I print this hash in the debugger, it looks like this:
DB<8> x %snmp
0 '127.0.0.1'
1 'Name=H003router : Location=Hub_room_3'
2 'h003.my.domain.com'
3 'Name=H003router : Location=Hub_room_3'
4 'h003'
5 'Name=H003router : Location=Hub_room_3'
(This isn't exactly a cut and paste, I've munged up the ip's and names
some. We don't really have a router at 127.0.0.1)
Anyway, this is a lookup table that I build once every month or so and
then a different program will use the table many times a day, and the
looking-up program doesn't know whether it will have ip, dns name or
alias as a key.
I use the storable module to save and later read the hash to/from disk
and having the data in there three times seems like a mighty waste of
space in my program, and a might waste of I/O time when I have to load
the hash to look up the data. Is there some more efficient way of
doing this?
I've thought of having the hash key refer to a integer that would be
the subscript of an array that contains the information, but that
seems kind of unwieldy. Does anyone have a better idea? (I know you
do.)
Thanks ever so much.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Wed, 19 Jul 2000 13:14:34 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Setting environment variables in Perl
Message-Id: <3975F00A.93D4FFE9@home.com>
hdaji@my-deja.com wrote:
>
> I am currently invoking a perl script through a command line on Unix
> platform. However when I call the same script from a cron scheduler it
> fails to find some PATH values. What I would like to do is "exactly
> match" all of the environemnt variables when run from the scheduler to
> those when run from the command line at the $ prompt as a normal user.
> By the way the cron job is submitted as a normal user.
If you know what things you need in your environment (and don't mind
hardcoding them) you can modify %ENV from within your script. (Which
would not affect the parent process' environment.) However, if you want
the two environments to match on their own... well, then you don't have
a Perl question and you should really ask this in an appropriate Unix
newsgroup.
-mjc
------------------------------
Date: Wed, 19 Jul 2000 15:15:24 -0400
From: "Jean-Francois" <irqjfl@hotmail.com>
Subject: Use root from a CGI
Message-Id: <c8nd5.5285$A4.93559@wagner.videotron.net>
Hello,
I'm the administrator of my server and I'd like to perform some root actions
from a CGI script. How can I do this?
I need to add users to my linux box with a cgi script from apache...
Please help me ASAP,
Thanks,
Jean-François
irqjfl@hotmail.com
------------------------------
Date: Wed, 19 Jul 2000 20:43:58 GMT
From: John Vicondoa <johnv@rentals.com>
Subject: Re: Use root from a CGI
Message-Id: <8l53u8$9ms$1@nnrp1.deja.com>
You can always use sudo.. but accessing root from your cgi script is
like playing with fire... I prefer the method of writing out to a file,
then having a cron running as a user with access to add users. But
that's just me.
John Vicondoa
In article <c8nd5.5285$A4.93559@wagner.videotron.net>,
"Jean-Francois" <irqjfl@hotmail.com> wrote:
> Hello,
>
> I'm the administrator of my server and I'd like to perform some root
actions
> from a CGI script. How can I do this?
>
> I need to add users to my linux box with a cgi script from apache...
>
> Please help me ASAP,
>
> Thanks,
>
> Jean-François
> irqjfl@hotmail.com
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 21:11:48 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Use root from a CGI
Message-Id: <8l55i2$au3$1@nnrp1.deja.com>
In article <c8nd5.5285$A4.93559@wagner.videotron.net>,
"Jean-Francois" <irqjfl@hotmail.com> wrote:
> Hello,
>
> I'm the administrator of my server and I'd like to perform some root
> actions from a CGI script. How can I do this?
>
> I need to add users to my linux box with a cgi script from apache...
>
CAVEAT LECTOR: there are some nasty security issues with the following
if you are not in a trusted environment somewhere!!!
Have the cgi write the updates to a specified directory and have a cron
job check it periodically for content. you may have to encrypt/decrypt
this information in order to offset some of the security problems.
THIS IS NOT NECESSARILY A GOOD SOLUTION TO THE PROBLEM!!!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 19 Jul 2000 23:20:39 +0200
From: "Ed Bras" <e.bras@hccnet.nl>
Subject: variable cheching ?
Message-Id: <8l561q$is9$1@enterprise.cistron.net>
How can I check the existens of a variable, which name is stored in another
variable ?
I don't how to use the values stored in a variable as a variable name !!
Regards,
Ed Bras
------------------------------
Date: Wed, 19 Jul 2000 14:46:58 -0800
From: kenned57@NoSpam.edu (Cameron Kennedy)
Subject: Re: variable cheching ?
Message-Id: <kenned57-1907001446580001@alexthinkpad.salk.edu>
In article <8l561q$is9$1@enterprise.cistron.net>, "Ed Bras"
<e.bras@hccnet.nl> wrote:
> How can I check the existens of a variable, which name is stored in another
> variable ?
>
soft references came to mind first.
if(${$var}){ do something}
or take your pick
$$var, ${$var}, and $${var}
but then i thought if you already know the name of the variable you want to
know about, why not check for it like any other ?
if( $var){}
Cameron
------------------------------
Date: Wed, 19 Jul 2000 18:27:30 GMT
From: |Odo| <jasonb885@my-deja.com>
Subject: Re: weird eval problem
Message-Id: <8l4rtq$2vl$1@nnrp1.deja.com>
In article <u9wviim5op.fsf@wcl-l.bham.ac.uk>,
nobull@mail.com wrote:
> |Odo| <jasonb885@my-deja.com> writes:
>
> > $value = eval '$self->'.${ $func }.'($h,$opts)';
>
> What the...?
>
> $func contains a reference to a scalar that in turn contains the name
> of a method?
Yep.
> If this is really the case then you can simply say:
>
> $value = $self->$$func($h,$opts);
Oh, oops. That looks too easy. I guess that's why I did it the hard
way. :)
> > Some of the token handlers (called by way of the eval '' above) also
> > call parse() to handle additional tokens. For some reason, when
these
> > handlers call parse() (after being called from within parse()), the
$h
> > hash ref is clobbered in the eval ''. Outside the eval, $h refs the
> > correct hash. The result is tokens called from within the eval no
> > longer have the correct $h passed to them. eval '' seems to be
keeping
> > the original, first 'copy' of $h and it continues to eval
> > '$self->token_handler($h,$opts)' using that $h.
>
> The fact that strings compiled at runtime using eval() can refer by
> name to lexical variables (which don't for most purposes _have_ names
> at run-time) is fairly deep voodoo. With my limited understanding of
> how lexical variables and re-entrancy are handled (see
> perlguts/"Scratchpads and recursion") this is exactly the sort of bug
> I'd expect.
Oh. I think I understand.
> > I only get this behavior with Perl 5.005_02 on a BSD box. Under
Perl
> > 5.005_03 on Debian GNU/Linux it works as I expect.
>
> So the most reasonable concusion is that the bug was fixed in
> 5.005_03.
I concur.
> > I'd just remove the eval, but all of the token handlers called are
> > autoloaded by SelfLoader, so I can't create a bunch of sub refs
keyed to
> > token handler names or anything like that to take eval '' out of the
> > equation.
>
> As far as I know there's no problem with symbolic method refs calling
> autoloaded methods.
Well, I'll give it shot.
> BTW: Method refs in Perl are of necessity symbolic so "use strict"
> doesn't bitch about them.
That's good to know. I finally started using strict about a year ago
and I'm sure it's saved me many a time from tripping over myself.
Thanks for the insight. I'm going to go make the appropriate changes
now.
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
>
--
Sincerely,
Jason Boxman
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3751
**************************************