Help - Search - Member List - Calendar
Full Version: combinations
WorkTheWeb Forums > Webmaster Resources > Perl Beginner Help
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
Support our Sponsors!
R. Joseph Newton
drieux wrote:

QUOTE

Malloc from the Top
Free From the Bottom

and whip out some sort of 'initializer' function that
will if the thingiePoo is non-Null start out by calling
the tree_traverser() that will decend the complex data
structure making sure that the leaf nodes can be tossed safely
till one gets to the top of the tree and it all be gone bye-bye!
At which point the initializer() will start hanging good stuff.
{ some cultists use the terms 'constructors' and 'destructors'
find the language you feel safest with }

I ahd a few chilling moments just now when I thought that all of this was necessary. I even
created a function to do this recursive "say bye-bye to each individual leafy-poo" routine:

delete_kids($hash_ref);

sub delete_kids {
my $hash_ref = shift;
foreach (keys %$hash_ref) {
delete_kids($hash_ref->{$_});
delete $hash_ref->{$_};
}
}

.... because I saw in my Task Manager that Perl was still holding onto the memory it had acquired
for a large multi-dimensional hash [actually, I kept it to three dimensions, since I was using
base 26 [a..z].] Then I got this wierd inkling that m-maybe this wouldn't be necessary after
all. Maybe the system simply wasn't so churlish, or resource-starved, as to need to reclaim
memory from a program that had needed it in the past, and might very well need it again. I think
that is what happended here:

Greetings! C:>perl -w
my $string = '';
my $hash_ref = {};

make_strings($hash_ref, $string);

sub make_strings {
my ($hash_ref, $start_string) = @_;
return if length($start_string) > 3;
for ('a'..'z') {
my $string = $start_string . $_;
$hash_ref->{$string} = {};
make_strings($hash_ref->{$string}, $string);
}
}

$hash_ref = {};

while (my $input = <STDIN>) {
last if $input eq "n";
$hash_ref->{$input} = 1;
print $input;
}

make_strings($hash_ref, $string);


while (my $input = <STDIN>) {
last if $input eq "n";
$hash_ref->{$input} = 1;
print $input;
}
^Z
Now I am in the pause mode. Memory usage stands at 73 MB, with no reduction in
memory use.
[echoed}
I will now restart the memory-grabbing process
....
# [Here I pressed the eneter key alone, to break out of the first loop]
It took only a few seconds this time for the algorithm to comlete.
....
Memory usage for Perl has climbed only slightly, to 73, 992 KB from about 73, 20
0.
....
The tree has been completely reconstructed, with minimal further demands on the
system.
....
This is an optimization, I am sure, of the NT memory manager.
This is an optimization, I am sure, of the NT memory manager. [echo retained]

Does the difference between the two memory readings represent a memory leak? I think that is
unlikely. If it were a true memory leak, it would have taken a much geater toll. More like the
OS simply lets the program keep memory that it seems to need, thus sparing the overhead of further
requests. The second round of loading this hash certainly wnent much more quickly, since Perl
could use its own internal allocation routines.

Joseph

Drieux
On Nov 30, 2003, at 2:39 PM, R. Joseph Newton wrote:

QUOTE
Does the difference between the two memory readings represent a memory
leak?
I think that is unlikely.  If it were a true memory leak, it would
have t
aken a much geater toll.  More like the OS simply lets the program
keep memory
that it seems to need, thus sparing the overhead of further requests.
The second round of loading this hash certainly wnent much more
quickly,
since Perl could use its own internal allocation routines.

I'm not sure I get your question/assertion here.
Are you attempting to establish that it is
impossible in perl to have memory leaks?

are you asking me to write you leaky perl code
to show you how to do it???

Have you actually read say

perldoc -q "How can I free an array or hash so my program shrinks"

so that you understand that once allocated to the program
that memory is not going to be handed back to the system?
And that as such, that is not a 'memory leak'? Just as
is true in the case of say C, C++, etc???

The reason that the 2..N iteration of reusing the same
memory that has been allocated runs faster is because
the memory space has already been allocated to the code.
Whereas in the first instance of growing out code runs
'slower' is that one is in the process of doing all of
the malloc-ing to get that code ( cf man malloc ).

Other things you might want to read on would be say:

<http://www.perldoc.com/perl5.8.0/pod/perl561delta.html#Known-Problems>
<http://www.perldoc.com/perl5.8.0/pod/perldebguts.html#Debugging-Perl-
memory-usage>


ciao
drieux

---

R. Joseph Newton
drieux wrote:

QUOTE
On Nov 30, 2003, at 2:39 PM, R. Joseph Newton wrote:

Does the difference between the two memory readings represent a memory
leak?



I think that is unlikely.  If it were a true memory leak, it would have
taken a much geater toll.  More like the OS simply lets > the program keep
memory
that it seems to need, thus sparing the overhead of further requests.
The second round of loading this hash certainly wnent much more quickly,
since Perl could use its own internal allocation routines.

I'm not sure I get your question/assertion here.
Are you attempting to establish that it is
impossible in perl to have memory leaks?

Nope. Not at all. Pathological cases can arise within any system. I would
say, though, that it generally does take a pathological case to induce such a
leak. Things can happen in forking that will do it. So, as you and I have
both pointed out, do circular references. I actually agre fully with what I
take to be your primary premise: that good program design is the best
prevention.

QUOTE
are you asking me to write you leaky perl code
to show you how to do it???

Hmmmm?/ Ah,... well, sure--if you can be conscise about it.

QUOTE
Have you actually read say

perldoc -q "How can I free an array or hash so my program shrinks"

Nope. Don't know what it is about my implementation of perldoc, but the "How
do I"s don't render much of use. I just stick to the keywords. I haven't
really searched on the problem, because it hasn't arisen. Until this morning,
when I cooked up that memory-grabber for the sake of this experiment, I had
never seen the Perl process take more than about 4 MB of memory.at any one
time. Just found it, with the more-terse "perldoc -q free". Cool. Sounds
like its not just on NT that programs retain their memory allocations.

QUOTE
so that you understand that once allocated to the program
that memory is not going to be handed back to the system?
And that as such, that is not a 'memory leak'? Just as
is true in the case of say C, C++, etc???

The reason that the 2..N iteration of reusing the same
memory that has been allocated runs faster is because
the memory space has already been allocated to the code.
Whereas in the first instance of growing out code runs
'slower' is that one is in the process of doing all of
the malloc-ing to get that code ( cf man malloc ).

Other things you might want to read on would be say:

<http://www.perldoc.com/perl5.8.0/pod/perl561delta.html#Known-Problems
<http://www.perldoc.com/perl5.8.0/pod/perldebguts.html#Debugging-Perl-memory-usage

Interesting references. I would say that the first speaks to a rather
perverse usage, though. We generally try to steer newbies away from the local
keyword, except for strictly scoped tweaks to certain built-in globals.
Generally, we just say: "Don't do that".

The second was an interesting confirmation of an impression I had when I
compared the allocation size to the number of actual hashes and elements in
the structure. My statement earlier was incorrect, though, when I said that
this structure only got to three dimensions. It only prcessed three
dimensions, but it did allocate memory for the fourth, giving it about 0.45
million elements, each an anonymous hash. That makes for about 140-150 bytes
per element, at 70-some MB for the entire structure.. It definitely is
something to keep in mind, but probably somewhere in the back of your mind.
Perl has a lot of overhead for each variable, and each variable is solid as a
tank. A very fair trade-off. Unless you are trying, as I was, to grab a big
chunk of memory, it usually isn't going to happen.

Joseph

Chris McMahon
I happened to be working on a TCP/IP server when this hit my desk
and having Programming Perl open to the correct page, thought I might as
well quote the "select..." line from the client code...

select ((select(Server), $| = 1)[0];
print Server "Howdyn";
$answer = <Server>;

from p 440 of the 3rd edition. Hope that helps, I've done servers
lots more than clients...
-Chris

-----Original Message-----
From: James Edward Gray II [mailto:[Email Removed]]
Sent: Monday, December 01, 2003 1:38 PM
To: Kipp, James
Cc: '[Email Removed]' List
Subject: Re: Can' t read all bytes from Socket

On Dec 1, 2003, at 2:31 PM, Kipp, James wrote:

QUOTE
Thanks. I tried turning off buffering on both ends, that
did not work.

In your example, you only call sysread() once.  Is that how you were
doing it?  If so, that's the mistake.  The one call got you
part of the
data.  Then you would loop, check and eventually call again
to get the
rest.  Make sense?

Yes, make sense, but not sure how to "check". Is this where select()
comes
in?

You got it.

QUOTE
Let me know if you want to see the entire code I am currently working
with.

Sure, especially if your client and server are small, post away. Tell
me what you're really trying to create too.

James

Drieux
On Nov 30, 2003, at 11:25 PM, R. Joseph Newton wrote:
QUOTE
drieux wrote:
[..]
Pathological cases can arise within any system.

yes, but they keep allowing the primates to code...
8-)

[..]
QUOTE
I haven't really searched on the problem, because it hasn't arisen.
Until this morning, when I cooked up that memory-grabber for the
sake of this experiment, I had never seen the Perl process take
more than about 4 MB of memory.at any one time.  Just found it,
with the more-terse "perldoc -q free".  Cool.  Sounds
like its not just on NT that programs retain their memory allocations.

Think about what happens when you Perl Extension
to an existing client api happens to have about
10,000 instances of objects doing say a
couple million transactions.... you know, to
do a statistically relevant delta between the
original c client and the perl and java interfaces.

You might want to go back and review the URL
on the 'unix philosophy' and remember that it is
a weltanschaung that is NOT tied to one given OS architecture.
<http://www.faqs.org/docs/artu/ch01s06.html>

To be honest, I envy your enjoyment of this problem.
Since I remember the day when I had that 'evil homer simpson'
moment when it Struck Me that 'duh!' OF course the code
has called sbrk() - cf man sbrk -

<rant>
"The brk and sbrk functions are historical curiosities left over from
ear-
lier days before the advent of virtual memory management."

HA! kids these days, now they insult us by calling
us 'historical curiosities' in the Man Pages... Wasn't like
that when I was growing up, kids had respect for their elders...
Why when back in the Good Old Days RealMen[tm] were not
afraid to do their own memory management the old fashion
way with Cold Iron they had smelted themselves.....
</rant>

sorry for the minor rant there... it's just that I
dislike the 'lack of respect' in the Man Page ...

But it also points to the
we have good news and we have information...

Most of the time Perl liberates the coder from having
to do many of the dull boring and tedious bits of keeping
track of 'memory issues'. The trade off as you note is
the overhead involved with having all that structure
around the variables in use, and with it the problem
of "ref, ref, who incr'd the refcount" and then having
to chase it down, AND KILL IT....

[..]
QUOTE
Generally, we just say: "Don't do that".

and when we are being polite we say

"I wouldn't do that, IT HURTS!"

all too often because of those 'painful memories'
of when WE did that 'oye, now that was DUMB!'

Folks need to remember that 'best practice'
comes with the rest of the set 'not so best practice'
and 'even less better practice' and 'OH that HURTS!'...

there are many 'unsolvable problems' that are always
amusing to watch folks seek solutions for,
'the church-turing thesis' cf
<http://plato.stanford.edu/entries/church-turing/>
AKA 'The Halting Problem'
<http://en2.wikipedia.org/wiki/Halting_problem>
and 'how do I find the dangling pointer' problem
that started this thread being two of my favorites...

and about the best that one can offer are the reminders
of 'best practice' that generically avoid most of the STOOPIDS.

[..]
QUOTE
It definitely is something to keep in mind, but
probably somewhere in the back of your mind. Perl has a lot of
overhead for each variable, and each variable is solid as a
tank.  A very fair trade-off.  Unless you are trying, as I was,
to grab a big chunk of memory, it usually isn't going to happen.
[..]


Back to why design leads to scoping is an Important Idea.
<http://perl.plover.com/FAQs/Namespaces.html>

Most 'scripters' have the luxury that their code comes
and goes quick enough that such things as remembering
to close file handles, and manage memory, is not a relevant
factor in the overall process. But that also leads to
lazy coding which in the long run will bite the coder.

But today's quick trick piece of code will wind up
being 'maintained' by someone - so growing one's
skill level will help in the long run.

ciao
drieux

---

James Kipp
QUOTE
Yes.  Calling sysread() gets you what's ready to be read UP TO the
amount of data you specify.  The rest probably just wasn't available
yet.  There could be a lot of reasons for this:  network lag,
operating
system buffers, etc.

Thanks. I tried turning off buffering on both ends, that did not work.

QUOTE

You're second example is line oriented.  It returns when it has
collected a whole line.  That's a big difference.

If you can get by with the line oriented reads and writes, by
all means
use them and save yourself a lot of pain.  That's rare in networking
though, in my experience.

I can live with reading line by line for now, but down the line....

QUOTE

If you really do need sysread(), you'll need to check it with
select()
to see when data is available and buffer your reads until you
know you
have an entire message.

select(), I was afraid somebody would mention that :)

QUOTE
Hope that helps.

Yes, thanks.

James Edward Gray II
On Dec 1, 2003, at 2:25 PM, Kipp, James wrote:

QUOTE
Yes.  Calling sysread() gets you what's ready to be read UP TO the
amount of data you specify.  The rest probably just wasn't available
yet.  There could be a lot of reasons for this:  network lag,
operating
system buffers, etc.

Thanks. I tried turning off buffering on both ends, that did not work.

In your example, you only call sysread() once. Is that how you were
doing it? If so, that's the mistake. The one call got you part of the
data. Then you would loop, check and eventually call again to get the
rest. Make sense?

James

James Edward Gray II
On Dec 1, 2003, at 2:25 PM, Kipp, James wrote:

QUOTE
select(), I was afraid somebody would mention that :)

The dreaded select() isn't as scary as it sounds, especially if you use
the IO::Select module. If you like books, Network Programming with
Perl is superb and covers all this well.

Good luck.

James

James Kipp
QUOTE

Thanks. I tried turning off buffering on both ends, that
did not work.

In your example, you only call sysread() once.  Is that how you were
doing it?  If so, that's the mistake.  The one call got you
part of the
data.  Then you would loop, check and eventually call again
to get the
rest.  Make sense?

Yes, make sense, but not sure how to "check". Is this where select() comes
in?
Let me know if you want to see the entire code I am currently working with.

Thanks Again.

Andrew Gaffney
Kipp, James wrote:
QUOTE
Thanks. I tried turning off buffering on both ends, that

did not work.

In your example, you only call sysread() once.  Is that how you were
doing it?  If so, that's the mistake.  The one call got you
part of the
data.  Then you would loop, check and eventually call again
to get the
rest.  Make sense?


Yes, make sense, but not sure how to "check". Is this where select() comes
in?

No. Try this:

connect(SOCK, $remote) or die "can't connect: $!n";

while($bytes = sysread(SOCK,$buf,4096)) {
$data .= $buf;
}
print "read $bytes bytes from server.n server said: $data";



--
Andrew Gaffney

James Edward Gray II
On Dec 1, 2003, at 2:31 PM, Kipp, James wrote:

QUOTE
Thanks. I tried turning off buffering on both ends, that
did not work.

In your example, you only call sysread() once.  Is that how you were
doing it?  If so, that's the mistake.  The one call got you
part of the
data.  Then you would loop, check and eventually call again
to get the
rest.  Make sense?

Yes, make sense, but not sure how to "check". Is this where select()
comes
in?

You got it.

QUOTE
Let me know if you want to see the entire code I am currently working
with.

Sure, especially if your client and server are small, post away. Tell
me what you're really trying to create too.

James

Drieux
On Dec 1, 2003, at 12:31 PM, Kipp, James wrote:

QUOTE
Yes, make sense, but not sure how to "check".
Is this where select() comes in?
Let me know if you want to see the entire code I am currently working
with.

p0: USE IO::Select, it will help
especially if you wind up needing
to deal with more than one socket.

p1: while the code was hacked for
dealing with dialogs on pipes:

<http://www.wetware.com/drieux/PR/blog2/Code/200311.html#id3152776334>

p2: a more complex version can be found at:

<http://www.wetware.com/drieux/pbl/Sys/gen_sym_big_dog.txt>

in the check_children() function where we use the can_read()
method for solving which FD to select.

ciao
drieux

---

James Kipp
QUOTE
Yes, make sense, but not sure how to "check". Is this where
select()
comes
in?

You got it.

Let me know if you want to see the entire code I am
currently working
with.

Sure, especially if your client and server are small, post
away.  Tell
me what you're really trying to create too.

James

Thanks. I am playing with select right now. Let me see if I can get it to
work

James Kipp
QUOTE
one way simplistic way to try the sysread() approach
would be go with something like

my $message;

my $bytes=1;
while ($bytes)
{
  $bytes = sysread(SOCK,$buf,4096);
  $message .= $buf;
  # or try say
  # last if eof(SOCK);
}


Yep, that worked. Thanks.

James Edward Gray II
On Dec 1, 2003, at 3:29 PM, McMahon, Chris wrote:

QUOTE

I happened to be working on a TCP/IP server when this hit my desk
and having Programming Perl open to the correct page, thought I might
as
well quote the "select..." line from the client code...

select ((select(Server), $| = 1)[0];
print Server "Howdyn";
$answer = <Server>;

from p 440 of the 3rd edition.  Hope that helps, I've done servers
lots more than clients...

select() unfortunately serves two not-well-related roles. This isn't
the one I was speaking of, though it could indeed prove usefully in
server programming.

I was speaking of using the four argument version of select() to poll
sockets you are waiting on. Others have shown that this isn't a must
in every case, but the main trick of network programming is usually,
doing multiple thinks at once. Simply reading and writing is two
actions, so it can be done at the same time and that's if we're only
talking about one connection. The server itself may also need to take
regular actions. That's where select()ing over non-blocking sockets,
fork()ing or threading come in, generally.

If your needs are simple enough, it's hard to beat the line oriented
routines for ease of use. If you need to do multiple things at once
though, sysread() probably isn't going to do it alone.

James

James Kipp
QUOTE
I happened to be working on a TCP/IP server when this
hit my desk
and having Programming Perl open to the correct page, thought
I might as
well quote the "select..." line from the client code...

select ((select(Server), $| = 1)[0];
print Server "Howdyn";
$answer = <Server>;


Thanks. I will give it a shot.

Drieux
On Dec 2, 2003, at 1:22 PM, McMahon, Chris wrote:
[..]
QUOTE
In particular, I just discovered IO::Socket::Multicast on CPAN which
looks very interesting, along with the rest of the IO::Socket family.
I've got a little experience with TCP/IP servers in Perl, and I've
been surfing ntop output on the corporate network for the last couple
of
months, so I'm not a complete newbie (but close).
[..]


First off
RUN AWAY! JUST SAY NO! DO NOT DO THIS!

right, so much for the obligatory warning.
{ this way I can later on say, "i tried to warn you."}

ok, first off, you will want to get the
two volumes of Steven's Network Programming
( 2nd editions, vol 1 & 2 )
cf
<http://www.kohala.com/start/>
as a basic starter since it is just worth it in
the long run to have them for later on as you
start having to get 'more technical'.

Accept the fact that there are some known bugs
in his demonstration code, but that too is
survivable, since you want to read it for ideas
and implement your own code. Much of which can
be as badly written in Perl as in 'c', caveat emptor.

Then you can wander into the ugly world either
directly, and code up your own madness, or decide
to have that sobriety moment, and opt to find
ways to use Perl to parse the output of things
like ntop and send you warnings, alerts, heads ups,
etc, etc, etc.

Or do you want to get into the frobnobulation of
writing client/server applications based upon your
own network protocol? If so, I started today's
rant about learning to do one's own header/payload
approach to doing client/server wacka-doo-dell-age:

<http://www.wetware.com/drieux/PR/blog2/Code/200312.html#id3153210608>

Is this my Bad Kharma coming back to me or What?

Oh yes, there is that minor set of issues with
Multi-Cast that you may want to worry about now,
namely the delta between ucp v. tcp - but I'm
sure you will want to think more about that after
you have decided if 'sane and sober' is a lifestyle
choice you want to make....

8-)

HTH.

ciao
drieux

---

James Edward Gray II
On Dec 2, 2003, at 3:22 PM, McMahon, Chris wrote:

QUOTE
Hello...

Howdy.

[snip background]

QUOTE
I'd be interested in any descriptions, stories, warnings, links, or
snippets about Useful Perl Network Stuff.  If it's too OT, feel free to
email me off the list.

Network Programming with Perl is the book I learned it all from. I
think it's terrific.

James

Wiggins D Anconia
QUOTE


Hello...
I'm starting to encounter a number of pretty sophisticated network
thingies of all descriptions, and I'd be interested in anyone's experience
writing network sniffers, drivers, test harnesses, or other frobnabulators
in Perl.
In particular, I just discovered IO::Socket::Multicast on CPAN which
looks very interesting, along with the rest of the IO::Socket family.
I've got a little experience with TCP/IP servers in Perl, and I've
been surfing ntop output on the corporate network for the last couple of
months, so I'm not a complete newbie (but close).
I'd be interested in any descriptions, stories, warnings, links, or
snippets about Useful Perl Network Stuff.  If it's too OT, feel free to
email me off the list.
Thanks...
-Chris

This is where I interject http://poe.perl.org and then hop on my ski's
to hit the learning curve slope that it provides.... But boy swishing
down those slopes can be fun!

http://danconia.org

Bob Showalter
drieux wrote:
QUOTE
On Dec 4, 2003, at 8:18 AM, Bob Showalter wrote:
Thomas Browner wrote:
Is there away to find all of the hostname on a lan with
use of perl?
[..]
You can query DNS to get the hosts in a domain using nslookup, dig,
host, or similar. For example:

host -l mydomain.com

If you want to talk to the resolver directly from Perl, you can use
the Net::DNS module.

first forgive the brief prefatory rant:

<rant
Bad BOB! Not Nice Bob! No Cookie!
</rant

Oy vey!

QUOTE

since what Bob has done with that 'host -l mydomain.com'
is oblige us to go back and REALLY work out what in
the DNS is a 'host' and what is the bloat in the
DNS that is not actually a Host, not in the sense
that most folks would think of.

$ host -ltA mydomain.com (:~)

[snip...]

QUOTE
So a part of the unpleasantry, is what exactly
is 'finding hosts on a Lan' really a question about...

No argument there.

Bob Showalter
[Email Removed] wrote:
QUOTE
Help. I'm a frustrated newbie who wants to use Perl to make
my life easier.

The following simple task is only one small part of a program
I'm trying to
put together to automate some things I currently do manually.

I have a file whose format looks like this:

name1          name2          name3
name4          name5          name6, etc.

The names are separated by spaces.  I need the names to be
one name per
line, like this:

name1
name2
name3, etc.

If the names don't include embedded spaces (i.e. all the whitespace is
delimiters), you can use the default split()
function for this:

while(<>) {
print "$_n" for split;
}

The perl one-liner for this would be:

$ perl -lne 'print for split' myfile.txt

....
QUOTE

My next Perl task after I get my list of one name per line,
is to sort the
list and eliminate duplicate names.

Let's take it step by step. Consider:

@arr = <>;

This reads all the input lines into an array. But we really want to split
each line into the separate names, so we use map for this:

@arr = map split, <>;

Sorting is trivial:

@arr = sort map split, <>;

Eliminating duplicates can be done through a standard trick:

@arr = do { my %seen; grep !$seen{$_}++, sort map split, <> };

Now @arr contains the unique names, in sorted order, ready to print out.

The perl one-liner would be:

perl -le 'print for grep !$seen{$_}++, sort map split, <>' myfile.txt

n.b., moving the sort from where it is to in front of the grep would be more
efficient if the number of duplicates is large.

HTH

Roberts Mr Richard L
does anyone know how to generate a java script alert window in perl? Or
better a alert window generated by perl. Its for a field validation in a
form...html

-----Original Message-----
From: david [mailto:[Email Removed]]
Sent: Friday, December 05, 2003 2:06 PM
To: [Email Removed]
Subject: Re: Frustrated newbie question


Stuart Clemons wrote:

QUOTE

I have a file whose format looks like this:

name1          name2          name3
name4          name5          name6, etc.

The names are separated by spaces.  I need the names to be one name per
line, like this:

name1
name2
name3, etc.

try:

[panda]# perl -i -pe 's/s+/n/g' names.file

this will make names.file look like:

name1
name2
name3
....

QUOTE

I currently use a macro with a text editor to clean up the file into the
one name per line format.  I can do this very quickly in contrast to the
the last two hours I've spent trying to figure out how to get Perl to do
this very simple task.  Arrggh !

To simply things, I just tried to take the following string and print it
out one name per line.

my $x = "name1    name2    name3";

I've tried various schemes using regex's and the ///s operator.  Most of
the time I get syntax errors and the few times I get anything to work,
it's not what I want.

you can use split, s/// or m//. for your purpose, they are bascially the
same:

#!/usr/bin/perl -w
use strict;

while(<>){

chomp;

#--
#-- $names[0] = name1
#-- $names[1] = name2
#-- ... etc
#--
my @names = split(/s+/);

#--
#-- you can even rewrite the above like:
#--
#-- my @names = split;
#--
#-- when you become more familiar with Perl
#--

#--
#-- prints the name out like:
#--
#-- name1
#-- name2
#-- name3
#-- ...
#--
print join("n",@names),"n";
}

__END__

you can also use m// like:

my @names = /S+/g;

which search for one or more none space characters that are stick together
and put each of them into @names.

or you can use s/// like:

s/s+/n/g; print "$_n";

which search for one or more continueous spaces and translate them into a
newline.

QUOTE
Anyway, any help at this point will be appreciated.  I'm hoping that in
the long run the time I spend learning Perl will pay off,

i think so.

david
--
s,.*,<<,e,y,n,,d,y,.s,10,,s
..ss.s.s...s.s....ss.....s.ss
s.sssss.sssss...s...s..s....
....s.ss..s.sss..ss.s....ss.s
s.sssss.s.ssss..ss.s....ss.s
...s..sss.sssss.ss.sss..ssss.
...sss....s.s....ss.s....ss.s

,....{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<-@{-},b-t,
..y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:-@^_{}.a-t ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval

--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Patrick Shoaf
What are you looking for?
IP addresses for machines?
Live IP Addresses?
Physical Machines?
DNS Information?
DHCP Machines?
Ethernet NIC Addresses?
or some combination?

What network structure are you using?
NetBeui?
TCP/IP?
IPX/SPX?
Other?

All this information can be gathered with perl. Some easier than
others. I have a script I wrote that pings IP's within a specified range,
tells me whether the IP is in use or not, what Name is assigned the IP and
whether the reverse lookup yields the same IP. (This script assumes ping is
answered by machine being pinged.) With Linux or Unix machine and perl,
the tools are there to find out just about anything you want about your
network.

At 02:45 PM 12/4/2003, Bob Showalter wrote:
QUOTE
drieux wrote:
On Dec 4, 2003, at 8:18 AM, Bob Showalter wrote:
Thomas Browner wrote:
Is there away to find all of the hostname on a lan with
use of perl?
[..]
You can query DNS to get the hosts in a domain using nslookup, dig,
host, or similar. For example:

host -l mydomain.com

If you want to talk to the resolver directly from Perl, you can use
the Net::DNS module.

first forgive the brief prefatory rant:

<rant
Bad BOB! Not Nice Bob! No Cookie!
</rant

Oy vey!


since what Bob has done with that 'host -l mydomain.com'
is oblige us to go back and REALLY work out what in
the DNS is a 'host' and what is the bloat in the
DNS that is not actually a Host, not in the sense
that most folks would think of.

$ host -ltA mydomain.com (:~)

[snip...]

So a part of the unpleasantry, is what exactly
is 'finding hosts on a Lan' really a question about...

No argument there.

--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response

Patrick J. Shoaf, IT Manager
[Email Removed]

Model Cleaners, Uniforms, & Apparel
100 Third Street
Charleroi, PA 15022
<http://www.model-uniforms.com/>http://www.model-uniforms.com
Phone: ext. 105
or 800-99 MODEL
Fax:

Pd Schloss
Hi,

I'm reviewing a perl script that someone wrote to do a statistical
analysis. I know it's bad form, but I was wondering if anyone knows
what the default seed is for the random number generator in Perl. They
haven't seeded it with "srand" - what does this do? It still seems to
pick random numbers, any ideas?

Thanks,
Pat

Rob Dixon
Pd Schloss wrote:
QUOTE

I'm reviewing a perl script that someone wrote to do a statistical
analysis.  I know it's bad form, but I was wondering if anyone knows
what the default seed is for the random number generator in Perl.  They
haven't seeded it with "srand" - what does this do?  It still seems to
pick random numbers, any ideas?

Hi. I wrote this back in March. I assume I was right :)

Rob Dixon wrote:
QUOTE

Interesting. Digging into the code for Perl v5.6.1, 'srand' will try to read four
bytes from the /dev/urandom device. If that fails, then it will read the current
time of day and mix it up with the PID, a Perl stack pointer and a few arbitrary
constants.

So, as it should be, there is no 'default' seed.

This probably doesn't help, but at least should end your search!

Cheers,

Rob

John W. Krahn
Pd Schloss wrote:
QUOTE

Hi,

Hello,

QUOTE
I'm reviewing a perl script that someone wrote to do a statistical
analysis.  I know it's bad form, but I was wondering if anyone knows
what the default seed is for the random number generator in Perl.  They
haven't seeded it with "srand" - what does this do?  It still seems to
pick random numbers, any ideas?

Download the source code for Perl if you don't already have it and have
a look at the pp.c file.


John
--
use Perl;
program
fulfillment

Tassilo Von Parseval
On Sat, Dec 06, 2003 at 04:38:02PM -0800 John W. Krahn wrote:

QUOTE
Pd Schloss wrote:

I'm reviewing a perl script that someone wrote to do a statistical
analysis.  I know it's bad form, but I was wondering if anyone knows
what the default seed is for the random number generator in Perl.  They
haven't seeded it with "srand" - what does this do?  It still seems to
pick random numbers, any ideas?

Download the source code for Perl if you don't already have it and have
a look at the pp.c file.

The actual seed is calculated in Perl_seed() in util.c. The calculation
of the seed itself is highly dependent on the platform used. It involves
various things, such as gettimeofday(2), the PID, a value read from a
random device such as /dev/urandom, the position of PL_stack_sp in
memory etc. For most cases it should be quite ok.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.t$&."'!#+sexisexiixesixeseg;y~n~~dddd;eval

John W. Krahn
Tassilo Von Parseval wrote:
QUOTE

On Sat, Dec 06, 2003 at 04:38:02PM -0800 John W. Krahn wrote:

Download the source code for Perl if you don't already have it and have
a look at the pp.c file.

The actual seed is calculated in Perl_seed() in util.c. The calculation
of the seed itself is highly dependent on the platform used. It involves
various things, such as gettimeofday(2), the PID, a value read from a
random device such as /dev/urandom, the position of PL_stack_sp in
memory etc. For most cases it should be quite ok.

I did a "grep -i -r 'seed' *.c" and the only hit I got was in pp.c.


John
--
use Perl;
program
fulfillment

Owen
On Sun, 07 Dec 2003 03:29:02 -0800
"John W. Krahn" <[Email Removed]> wrote:


QUOTE
I did a "grep -i -r 'seed' *.c" and the only hit I got was in pp.c.


FWIW

[root@localhost perl-5.8.2]# grep -r seed
<snip>
util.c:Perl_seed(pTHX)
util.c: * is enough real entropy to fill the seed. */
util.c:Perl_get_hash_seed(pTHX)
util.c: UV myseed = 0;
util.c: myseed = (UV)Atoul(s);
util.c: /* Compute a random seed */
util.c: (void)seedDrand01((Rand_seed_t)seed());
util.c: myseed = (UV)(Drand01() * (NV)UV_MAX);
util.c: myseed +=
util.c: if (myseed == 0) { /* Superparanoia. */
util.c: myseed = (UV)(Drand01() * (NV)UV_MAX); /* One more chance. */
util.c: if (myseed == 0)
util.c: PL_rehash_seed_set = TRUE;
util.c: return myseed;
<snip>


--
Owen

John W. Krahn
Owen wrote:
QUOTE

On Sun, 07 Dec 2003 03:29:02 -0800
"John W. Krahn" <[Email Removed]> wrote:

I did a "grep -i -r 'seed' *.c" and the only hit I got was in pp.c.

FWIW

[root@localhost perl-5.8.2]# grep -r seed
<snip
util.c:Perl_seed(pTHX)
util.c:    * is enough real entropy to fill the seed. */
util.c:Perl_get_hash_seed(pTHX)
util.c:    UV myseed = 0;
util.c:  myseed = (UV)Atoul(s);
util.c:  /* Compute a random seed */
util.c:  (void)seedDrand01((Rand_seed_t)seed());
util.c:  myseed = (UV)(Drand01() * (NV)UV_MAX);
util.c:  myseed +=
util.c:  if (myseed == 0) { /* Superparanoia. */
util.c:      myseed = (UV)(Drand01() * (NV)UV_MAX); /* One more chance. */
util.c:      if (myseed == 0)
util.c:    PL_rehash_seed_set = TRUE;
util.c:    return myseed;

It must have been moved there for version 5.8 because it is not there in
5.6.


John
--
use Perl;
program
fulfillment

Stuart Clemons
Hi drieux:

The link that failed for you, worked for me. That link led to this link
which had the code.

http://products.daviddurose.com/cgi-bin/do...cgi?script=sort


----- Message from drieux <[Email Removed]> on Sun, 7 Dec 2003 09:04:51
-0800 -----
To:
Perl Perl <[Email Removed]>
Subject:
Re: sorter script [was: Frustrated newbie question]

On Dec 7, 2003, at 3:31 AM, John W. Krahn wrote:
[..]
QUOTE

http://www.downloaddatabase.com/databaseso...rter-script.htm

Why?

more importantly,

How?

I have tried a couple of times to download it
and get nothing. the retreat to the handy dandy

GET -d -u -U -s -S -e
http://www.downloaddatabase.com/databaseso...load-db-sorter-
script.htm

is not giving me any insight into what is going on...


ciao
drieux

Jon Seidel
Nyimi...

Thanks for your reply; I figured it out (there already was a '1' at the end
of my module).

I had used h2xs to create the module framework... that framework requires
exporter and then exports the name 'AutoLoader'. Once I took that out,
everything worked fine.

Thanks again...jon

Nyimi Jose wrote:

QUOTE
Try putting
1;
As the last line of your GroupRank.pm file.

Remember that a module (*.pm file) is
supposed to return a true value.

Jos.

-----Original Message-----
From: david [mailto:[Email Removed]]
Sent: Monday, December 08, 2003 7:06 PM
To: [Email Removed]
Subject: Re: Can't find package AutoLoader in CGI::Application program


Jon Seidel wrote:

[snip]

The beginning of my GroupRank.pm file looks like this:
/////////////////// package GroupRank;
use base 'CGI::Application';
use AutoLoader;
#use DBI;

use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
$|++;

your GroupRank.pm module doesn't seem to return a true value. change
'$|++;' to '$|=1;' and see what happen.

david


Jeff Westman
Tom Kinzer <[Email Removed]> wrote:

QUOTE
Try this:

Caveat: This all assumes LOTS about the format of your data being
consistent, and so should be treated as a "quick and dirty" as opposed to
anything resembling a robust application...  I'm not sure what your
intention with the script is, but is worth mentioning.

-Tom Kinzer

__SNIP__

my $input  = '/appl/log/200301130.txt';
my $total;
die "Usage: Arg1: Input File to Scan."
unless $input;

open IN, "< $input" or die "Unable to open $input for reading, $!,
stopped";


while ( <IN> ) {
if ( /  Document Format/ ) { last };
}

while ( <IN> ) {
if ( /  Total:                        -------------/ ) { last };
}

while ( <IN> ) {
if ( /^s*d+/ ) {
    chomp;
    s/s*(d+)s*/$1/;
    $total = $_;
    printf "Total: %010sn", $total;
    last;
}
}

close IN;

__END__

Don't you need to do a

seek(IN,0,0)

in between each while loop?

Why have three while loops; why not incorporate this into a single loop?


-Jeff


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

Tom Kinzer
Try this:

Caveat: This all assumes LOTS about the format of your data being
consistent, and so should be treated as a "quick and dirty" as opposed to
anything resembling a robust application... I'm not sure what your
intention with the script is, but is worth mentioning.

-Tom Kinzer

__SNIP__

my $input = '/appl/log/200301130.txt';
my $total;
die "Usage: Arg1: Input File to Scan."
unless $input;

open IN, "< $input" or die "Unable to open $input for reading, $!, stopped";


while ( <IN> ) {
if ( / Document Format/ ) { last };
}

while ( <IN> ) {
if ( / Total: -------------/ ) { last };
}

while ( <IN> ) {
if ( /^s*d+/ ) {
chomp;
s/s*(d+)s*/$1/;
$total = $_;
printf "Total: %010sn", $total;
last;
}
}

close IN;

__END__

-----Original Message-----
From: Katka a Daniel Dunajsky [mailto:[Email Removed]]
Sent: Monday, December 08, 2003 12:15 PM
To: [Email Removed]
Subject: Reading a log file, again


Hello Tom,

I hope you are in a good time again, because I would like to ask you for
help again.
The first script that you did send to me works well. The problem is that I
was not accurate with the situation description.
From what I understand, your script looks for Total: and then for
following line with numbers, reads them and prints them. That is what I
need. However, there are 3 sections with Total: and I am interested only
in one of them. I was trying to solve this issue by modifying your script,
now it looks like this:

#!/usr/local/bin/perl -w
use strict;

my $input = '/appl/log/200301130.txt';
my $total;
die "Usage: Arg1: Input File to Scan."
unless $input;

open IN, "< $input" or die "Unable to open $input for reading, $!, stopped";

while ( defined(<IN>) ) {

while ( <IN> ) {
if ( / Document Format/ ) { last };
}

while ( <IN> ) {
if ( / Total: -------------/ ) { last };
}

while ( <IN> ) {
if ( /^s*d+/ ) {
chomp;
s/s*(d+)s*/$1/;
$total = $_;
printf "Total: %010s", $total;
}
}
}

close IN;

Your script without modification returns 3 values:
Total: 000052,497Total: 000049,670Total: 000049,670.
After the change I implemented it returns 2 values:
Total: 000049,670Total: 000049,670.
The section I am interested in (in the log file) starts with Document
Format and then there is the Total: and the number returned is the
first 49,670 returned after modification. The second number I am not
interested in and I dont know how to limit script from continuing further
down. Could you please advice?

Thank you for your time.

danield

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=dept/features&pg...tp%3a%2f%2fjoin.
msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca

Drieux
On Dec 8, 2003, at 11:18 AM, Jason Dusek wrote:
[..]
QUOTE
I think drieux has raised a good point in taking
a shot at the 'learning how to think' snobbery too
common among college graduates.
[..]


It is not so much a shot at 'snobbery' as it
is at the lack of 'intellectual rigor' that
the phrase bleats like a sheep. The university
system is having a lot of problems with justifying
it's existence. The older notions of it being a
prepatory system for taking over the reigns of
government and commerce are a bit strained as an
excuse to get Government and/or Private Sector Funding.
In PART because with things like the Internet, IF
one wants to learn, one can and at far cheaper rates.
You might also notice that in the UK the phrase is
"reading for..." rather than the american 'majoring in'.

So let me smack you about the head and shoulders on
the problem with getting 'student loans' - have you
ever thought of the simpler approach? Put together a
business plan, shop it around, get some Angle Funding
and go for an "A" round of funding??? The alternative
of course is to get a RealJob[dm] and let it pay the
cash flow for the duration while you master the art
of codeMongering or what ever.

One could tell those of us in the 'start up' who had
put in some time 'raising funding', 'the old fashion way',
from those who were lucky enough to get 'college grants,loans,etc'
to help them run their college Gambits. They learned one
set of 'rules' about doing 'risk analysis', which really
is the point you are trying to bang at with your kvetch
about 'powerful people' and 'break/bend' the rules. Which
I think is a part of what you are trying to smack with
the 'snobbery' point.

Those of us with the 'alternative' route through the
academic minefields arrived understanding other forms
of risk analysis. Ironically, the same set we use to
resolve do we want/need a 'strongly typed language'
so that our compiler will save us - or can we live
with bringing our 'A game' to the process - and
place it all on one chance of pitch and toss...

Learn to be nice to undergrads and grad students.
Think about the unpleasant lack of experience that
they have in a wide range of issues. Most of them
grew up in normal homes with median types of families.
ALL they have to 'validate their personhood' IS that
college degree, and their 'connections'. Unlike
the rest of us who have different sets of 'connections'
and different sets of Rules that drive our 'risk analysis'.

At best they know what they have been taught,
and rarely have they had the time to test their
speculations. So if you want to learn Perl, learn it!
Test out Ideas! See how things can be done! That
good old fashion all american approach of basing
one's opinion upon what one has DONE....

There will always be poseurs. There will always
be shisters, shills, and hustlers.

IF you learned how to do the process of learning,
Then WHY get a college degree??? IF your skill
mix is taking you where you want to be, then
rock ON! if it is not, figure out where you
want to be and go there.

so that we are clear, I had $65 in my jeans,
an address from people in the old country,
and everything on my back when I landed at O'Hare.

Any Questions?


ciao
drieux

---

Tassilo Von Parseval
On Mon, Dec 08, 2003 at 12:43:37PM -0800 drieux wrote:

QUOTE
Learn to be nice to undergrads and grad students.
Think about the unpleasant lack of experience that
they have in a wide range of issues. Most of them
grew up in normal homes with median types of families.
ALL they have to 'validate their personhood' IS that
college degree, and their 'connections'. Unlike
the rest of us who have different sets of 'connections'
and different sets of Rules that drive our 'risk analysis'.

Pretty big words by someone who happily admits to not have chosen the
academic part. I wonder whether you really know so much about the
contents of academic studies.

QUOTE
At best they know what they have been taught,
and rarely have they had the time to test their
speculations. So if you want to learn Perl, learn it!
Test out Ideas! See how things can be done! That
good old fashion all american approach of basing
one's opinion upon what one has DONE....

And at this point it gets utterly ridiculous. Since this is a list
dealing with Perl, we can try to make this thread a little more on topic
by looking at the people who made and still make Perl. The current set
of perl-porters that are able and willing to work on the core are with
not many exceptions people with academic degrees. There are others as
well, but those are usually not responsible for the tricky bits that do
require more than a little bit of self-teaching: you don't usually
self-teach yourself enough number theory that is necessary for coming up
with a sane hashing-algorithm or random number generator. A self-taught
programmer will most definitely not be able to understand (let alone
create) a regular expression engine. The things to be considered when
crafting a memory allocater are usually beyond the things an autodidact
has picked up. It's stuff that can be found in the old venerable
computer-science text books that are recommended in academic circles.

QUOTE
IF you learned how to do the process of learning,
Then WHY get a college degree??? IF your skill
mix is taking you where you want to be, then
rock ON! if it is not, figure out where you
want to be and go there.

I am sorry. This only works for the very simple problems. Those
problems, that are indeed not teached in university, because a graduate
is expected to acquire these things on his own.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.t$&."'!#+sexisexiixesixeseg;y~n~~dddd;eval

R. Joseph Newton
Tom Kinzer wrote:

QUOTE
Try this:

Caveat: This all assumes LOTS about the format of your data being
consistent, and so should be treated as a "quick and dirty" as opposed to
anything resembling a robust application...  I'm not sure what your
intention with the script is, but is worth mentioning.

-Tom Kinzer

Hi Tom,

I think this may be getting too complicated. My understanding is that the OP was
actually interested in a single datum, the total figure at the bottom. I haven't
seen any clarification indicating otherwise, so I would suggest just doing it:

my $junk = '';
$junk = <DATA> until $junk =~/^Total/;
$pot_o_gold = <DATA>;
$pot_o_gold =~ s/^s*//;
chomp $pot_o_gold;
print "I got my value, and it's $pot_o_goldn";
__DATA__
....
Format count
a 100
b 51
c 130
d 5
e 6
Total: ---
292
I got my value, and it's 292

Remember KISS.

Joseph

Tom Kinzer
OP said:
"From what I understand, your script looks for 'Total:' and then for
following line with numbers, reads them and prints them. That is what I
need. However, there are 3 sections with 'Total:' and I am interested only
in one of them. "



2 preceding bits of info determine which is the right one.

-Tom Kinzer


-----Original Message-----
From: R. Joseph Newton [mailto:[Email Removed]]
Sent: Monday, December 08, 2003 7:02 PM
To: Tom Kinzer
Cc: Katka a Daniel Dunajsky; Beginners Perl
Subject: Re: Reading a log file, again


Tom Kinzer wrote:

QUOTE
Try this:

Caveat: This all assumes LOTS about the format of your data being
consistent, and so should be treated as a "quick and dirty" as opposed to
anything resembling a robust application...  I'm not sure what your
intention with the script is, but is worth mentioning.

-Tom Kinzer

Hi Tom,

I think this may be getting too complicated. My understanding is that the
OP was
actually interested in a single datum, the total figure at the bottom. I
haven't
seen any clarification indicating otherwise, so I would suggest just doing
it:

my $junk = '';
$junk = <DATA> until $junk =~/^Total/;
$pot_o_gold = <DATA>;
$pot_o_gold =~ s/^s*//;
chomp $pot_o_gold;
print "I got my value, and it's $pot_o_goldn";
__DATA__
....
Format count
a 100
b 51
c 130
d 5
e 6
Total: ---
292
I got my value, and it's 292

Remember KISS.

Joseph

Marcos Rebelo
This absurd discotion. For a non University guy

If I have a list like 2,1,3,4,5,6,7,8,9,10,11, ..., let's say 99% sorted,
and I need to sorted again. Witch algorith shall you use and why? If you
have been in the university this must be a simple unswer, for the rest they
maus already have stady a bit.

Probably many of the perl programmers work in some informal environment,
they have to do DB Design, normalization, optimizaction, ... All the person
in of this group know what meens this 3 words.

Onother thing one programmer must know, UML.

I could give you many more examples. Books can help you learn this but you
need some to really correct your errors.

Before I can say that I'm a Perl Programmer, I have to say that I'm a
Programmer.

Thanks
Marcos

Marcos Rebelo
please let's do a split(/s/, "Perl Programmer").

this return one array with two scalar:
Perl
Programmer

that's why

-----Original Message-----
From: drieux [mailto:[Email Removed]]
Sent: Tuesday, December 09, 2003 11:01 AM
To: Perl Perl
Subject: Re: The True Path to Learning Perl Re: [OT] Education Level



On Dec 9, 2003, at 1:57 AM, [Email Removed] wrote:

QUOTE

Before I can say that I'm a Perl Programmer, I have to say that I'm a
Programmer.



why?

ciao
drieux

---


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Tim Johnson
I think that we've drifted a little from the topic, which was more or
less to get a feel for the people on this list and where they are in
their education, not to get in a "university vs. self-teaching"
argument. Personally I don't think it would be pragmatic for most
Perlers out there to learn enough number theory to write their own
hashing algorithm any more than a contractor needs to understand the
chemical composition of the concrete he pours, and if you'll allow me to
continue the analogy a bit further, it also doesn't mean that he can't
buy the same textbooks and learn that information. I will admit that
the level of dedication and self-sacrifice required is exceedingly rare,
and I'm stretching the analogy pretty thin anyway, so I'll leave it
there.


QUOTE
-----Original Message-----
From: [Email Removed]
[mailto:[Email Removed]] On Behalf Of Tassilo von

Parseval
QUOTE
Sent: Monday, December 08, 2003 2:51 PM
To: drieux
Cc: Perl Perl
Subject: Re: The True Path to Learning Perl Re: [OT] Education Level

The current set of perl-porters that are able and willing to work on the
core are with not many exceptions people with academic degrees. There
are others as well, but those are usually not responsible for the tricky
bits that do require more than a little bit of self-teaching: you don't
usually self-teach yourself enough number theory that is necessary for
coming up with a sane hashing-algorithm or random number generator. A
self-taught programmer will most definitely not be able to understand
(let alone create) a regular expression engine. The things to be
considered when crafting a memory allocater are usually beyond the
things an autodidact has picked up. It's stuff that can be found in the
old venerable computer-science text books that are recommended in
academic circles.

Drieux
On Dec 8, 2003, at 2:50 PM, Tassilo von Parseval wrote:
[..]
QUOTE
The current set of perl-porters that are able and willing
to work on the core are with
not many exceptions people with academic degrees.
[..]


hypothetical question,

would one need to be a perl-porter
to write good perl?
{ would it be impolite to note in which language/languages
the perl executable is 'written in'??? }

at which point of course we could get massively
pedantic and ask why a variety of critical
encryption modules are delivered as assembler,
and not even as 'c' code... but let us not get
too morosse about the limitations of the autodidact.

{ god, but it's been some time since anyone has
called me, or implied, such a polysyllabicsequipedalianism
in my direction. }

but since you have been ever so polite as to offer
the opportunity, allow me to note one of my most favorite
and silly misadventures in AcadamiaLand, that charming
dashing PhD from MIT who was trying to explain 'security'
based upon calculations of the 'cost' of a brute force
attack ... and I tried to disabuse him of his computational
wizBangery that if one is actually seeking to crack SIGINT
that is not how one goes about it. The more pleasant times
of course were fun with the fine prof with at least a sense
of elan about the limitation of what he could teach UnderGrads
in a computer class on statistical modeling. Fortuitously
for me he was 'moon lighting' at the Naval War College, and
so was willing to be frank about the folly of statistical
analysis, and that there is an 'art' that is not merely
the computational component. Or what those of use who had
done 'TMA' - Target Motion Analysis - always cite the
venerable 'still bill' -

and here you do a 'package check',
and if they are big and brassy...

Needless to say the real fun was meeting the gentleman, who
wound up as a co-worker, who had introduced my 'academic
advisor' to fortran, and then having the fun of sharing my
concerns with my former academic advisor as to why it was
that they had not introduced, or discussed, say lex or yacc,
and the general issues of Regular Expression Engines as a
part of the core of their under-grad programme - never mind
'make' et al and there wasn't so much as a by your leave
about the importance, and/or socio-cultural issues, with
'source code control systems' ....

{ funny the drieux should be whining about this with
source code control
build and release
installation process
documentation,

and prefers to do his RegEx in Perl than in flex/byacc... }

I could go on about the Fun Filled Excitement of reaching
for my knuth, and remembering having seen a reference, and
then finding that the idea was for the volume he never
published... Oye the Pain, had to fix it in code myself
the old fashion way...

So when you put my comments to Jason, and those who like
jason, may be having issues with the INSANITY of the
american educational system, back into their context,
then you might want to actually go back and re-read them
for what they are.

American society has a lot of issues, and the 'snobbery' of
our psuedo intellectuals IS a part of that problem. So when
folks step back and put all of that undergrad/gradSchool
gambiting back into context it is a whole lot simpler to
live with. As I tried to explain to annie who was at
Harvard Divinity and complaining about the 'pasty faced'
nature of those gradBoys, a part of the problem was that
she had taken a bit of time out for things like Refugee
Relief Groups and had the misfortune of being involved
with people who had a wider range of life experiences than
merely trying claw their way to the top of the old academic
food chain by any means possible. People who's whole sense
of Self rested upon such chimera as their SAT/MSAT/GSAT
numbers and their 'certifications' rather than any actual
real live,

"this is no shit, you should have been with us when..."

So when I am attacking 'support' for my kvetching at the
limitations of the actual academic rigour that college
can not teach one to THINK, but can at best provide
one with a context to "develop the habit of formal analysis"
it might be useful to try to come at me with something a
bit more loaded than the perl-porters capabilities.

I can and DO appreciate that there are still too many in
america who have tied too much of their sense of self and
identity into the "importance" of their college degree as
some gateway... but maybe detaching one's self from such
false Idolatry Might help???

yes, yes, I know you are posting from aachen, so take the
liberty moment and enjoy that I am not complaining about
Germany... But if you wish I can do a few Herr Doktor
stories if that would make you feel fuzzyWarm?

now let us return to the comical part:

QUOTE
IF you learned how to do the process of learning,
Then WHY get a college degree??? IF your skill
mix is taking you where you want to be, then
rock ON! if it is not, figure out where you
want to be and go there.

I am sorry. This only works for the very simple problems.
Those problems, that are indeed not teached in university,
because a graduate is expected to acquire these things on his own.

Which side of being pro-perl were you on again?

If one is expecting that a graduate will acquire
these skills on their own, then are we not advocating
that folks will be learning things that are outside
of the academic constraints of the university... Since
clearly the 'simple problems' are solvable without
going to university... Hence one should be able to
pick up the llama books, and yes, PICK UP that one
on learning Perl Objects, References and Modules, as
well as the 3rd Edition...

So one wanted the university system for what again???

TO learn how to write 'sane hashing algorithms' - which
is why one is not using the Perl Hash???

I can appreciate that I clearly must have ruffled some
feathers, but could the issue be that there is a boring
practicality to Perl that still escapes you? A practicality
that any reasonable person can acquire??? If on the other
hand what they WANT is to understand 'algorithm construction'
and sound 'performance analysis' - and the only place that
one can do that is, allegedly, in 'the university' then go
to it! DO THAT! But suddenly one has a Reasonable Excuse
to be IN COLLEGE somewheres! But if the programme is not
taking you where you want to go, BAIL! GET OUT! RUN AWAY!

What is the worst that happens?

Forgive me for for one last sea story, but an associate
shared the fun of a job interview that was 'going south'
as he decided these were not folks he really wanted to
work with, and they posited the 'money question' to
which he replied,

"They were paying me $65 a month more to kill people..."

now there were people who didn't have a Union to fall back on.

So maybe folks should be worrying about the money they are
making for what ever it is they are getting paid to do? They
should be improving their skill mix to work on issues that
they can get paid for???

Hey, there are worse ways to cover the rent...

ciao
drieux

---

Drieux
On Dec 8, 2003, at 10:31 PM, Tim Johnson wrote:
[..]
QUOTE
I will admit that the level of dedication and
self-sacrifice required is exceedingly rare,
and I'm stretching the analogy pretty thin anyway,
so I'll leave it there.
[..]


Since I have stirred up some apparent confusion here,
let me try to be clear in the response. I am not now,
nor am I in any way impugning the technical expertise
or skill of the perl porters, by what ever means that
they have acquired their expertise.

An argument of 'academic' v. 'autodidactic' is functionally
useless - since there are those who learn best from hands
on experience, and those who learn from a more formal
approach to the pedagogical arts. The challenge for the
student is to figure out which is the better course of
action for themselves. The problem then is resolving
the relationship between what one 'knows' and what
one can 'sell'.

Allow me to offer an argument by analogy that may help
clarify the position. I was standing the duty as the
AJOD ( Assitant Junior Officer of the Deck ) to a
BM2 Holly ( boy does that tell you where we were on
the pecking order ) and I asked him why, with his skill
set he had not gone into the 'data processing' ratings.
He shared with me the very useful perspective. As a
"simple" (HA!) boatswain's mate he had a better line of
advancement than had he gone into the canonical path
for persons who were rated to work with 'information
technology systems' - and could also secure for himself
the time to 'screw around with computers' that he preferred
to do, and was really good at doing, and as such was
providing the 1st Lt's Locker with a-j-squared away
'computer support' that they could not otherwise secure
by 'formal and official' channels.

Perl as a tool is the Boatswain's Best Friend. I would
not at all be surprised to find Holly Hacking Perl. He
had a keen intuitive understanding for what was USEFUL.

As I would explain to the VP of Engineering at one place,
when he failed to understand the deep inner 'religious
commitment' that some of us have for 'jury rigging', it
is that FINE ART of getting the ship back to port so that
all of them thar High Priced Naval Engineers can do the
voodoo they do so well. But that potential availablity
of the 'high priced help' is really not gonna do anyone
any good over the 50 fathom curve if we turn into REEF FODDER.

So if, as Dan Muey has found the inclination, one is interested
in better understanding say 'c' and how to deal with 'pointers'
and memory allocations, then please avail one's self of the
same 'learning to learn' skills that one acquired to learn
about Perl to learn about 'c code'. And IF one really does
need to be implementing 'cost effective' algorthims, please,
do not let me be the excuse for NOT getting the level of
competent training that would help you get there.

IF one REALLY wants to do that with some sense of funk,
then download the current release of the perl source
code and rummage around in it. Just as you would rummage
round in a Perl Module. IF you don't get it, then send
email off to the cat who cut the code and say,

Hey, in foo.c you did....

most of them will be more than willing to explain why
they went that way...

But just like you learned how to learn Perl remember
that 'c', et al, has it's, well, foibles, arcanea,
and whizz bangery stuff...



ciao
drieux

---

Tassilo Von Parseval
On Mon, Dec 08, 2003 at 11:33:08PM -0800 drieux wrote:

QUOTE
On Dec 8, 2003, at 2:50 PM, Tassilo von Parseval wrote:
[..]
The current set of perl-porters that are able and willing
to work on the core are with
not many exceptions people with academic degrees.
[..]

hypothetical question,

would one need to be a perl-porter
to write good perl?

Had you questioned that one needs an academic degree to learn Perl, this
would be a viable question. But that was not what you said. Let's
refresh your memory:

QUOTE
Learn to be nice to undergrads and grad students.
Think about the unpleasant lack of experience that
they have in a wide range of issues. Most of them
grew up in normal homes with median types of families.
ALL they have to 'validate their personhood' IS that
college degree, and their 'connections'. Unlike
the rest of us who have different sets of 'connections'
and different sets of Rules that drive our 'risk analysis'.

You were referring to a 'wide range of issues' and not to Perl in
particular.

I was targetting the cited paragraph. I don't argue that
you need the academic background to learn a programming language.
However, knowing a language itself isn't very much compared to the
problems that are waiting to be solved using this language.

QUOTE
{ would it be impolite to note in which language/languages
the perl executable is 'written in'??? }

Not at all, why should it?

QUOTE
but since you have been ever so polite as to offer
the opportunity, allow me to note one of my most favorite
and silly misadventures in AcadamiaLand,

[ little fairy-tail snipped ]

You'll have a hard time trying to induce the general from the particular
case. You'd need a proper induction for that which you haven't provided.

QUOTE
So when you put my comments to Jason, and those who like
jason, may be having issues with the INSANITY of the
american educational system, back into their context,
then you might want to actually go back and re-read them
for what they are.

Unfortunately, you haven't provided this context. Furthermore, I don't
find any notion of the word "America" or "American" in your posting I
was referring to. Hence I must assume that you were talking about
academia in general.

QUOTE
yes, yes, I know you are posting from aachen, so take the
liberty moment and enjoy that I am not complaining about
Germany... But if you wish I can do a few Herr Doktor
stories if that would make you feel fuzzyWarm?

No, it wouldn't. Besides, I take the liberty to claim that I have in
general quite a good insight into the German academic system. It does
have its rotten parts but it clearly does not suffer from any of the
points that you mentioned.

QUOTE
I can appreciate that I clearly must have ruffled some
feathers, but could the issue be that there is a boring
practicality to Perl that still escapes you?

Me escaping Perl's practicality? No, I don't think so. And I wouldn't
indulge with Perl if I found it boring, would I?

QUOTE
A practicality that any reasonable person can acquire??? If on the
other hand what they WANT is to understand 'algorithm construction' and
sound 'performance analysis' - and the only place that one can do that
is, allegedly, in 'the university' then go to it! DO THAT! But suddenly
one has a Reasonable Excuse to be IN COLLEGE somewheres! But if the
programme is not taking you where you want to go, BAIL! GET OUT! RUN
AWAY!

Anyway, you are switching topic once again. I can only follow-up to
things that have actually been there. None of the above was to be found
in this previous posting of yours though.

The credo of your original message was rather flat and shallow: Avoid
university at all costs because it can't teach you anything worthwhile.
This is an immature statement which I addressed.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.t$&."'!#+sexisexiixesixeseg;y~n~~dddd;eval

Drieux
On Dec 9, 2003, at 1:24 AM, Tassilo von Parseval wrote:
[..]
QUOTE
hypothetical question,

would one need to be a perl-porter
to write good perl?
[..]


let us get simple.

how about answering the simple question.

it was the core of your alleged argument.
IF you can make it fly, great. Otherwise,
feel free to deal with what ever issue you
think you need to deal with.

I proposed the question based upon your argument
and the amusement from an interview in which I had
a lot of fun with their 'perl guy' as we were playing
around and got into those 'and how is this implemented
in perl' stuff that had to deal with all of this interesting
intellectualizing about perl at IT's code level, vice
Perl the coding language, at which point I merely
countered with the classical,

If run time efficiency is our issue, then why
exactly are we buying that overhead to have a run
time compile of the code vice a pre-built build of
the code optimized for the hardware specific OS and
it's implementation of that Machine Language?

So Please. Carry On with your crusade...

ciao
drieux

---

Drieux
On Dec 9, 2003, at 1:57 AM, [Email Removed] wrote:

QUOTE

Before I can say that I'm a Perl Programmer, I have to say that I'm a
Programmer.



why?

ciao
drieux

---

Tassilo Von Parseval
On Tue, Dec 09, 2003 at 01:43:06AM -0800 drieux wrote:

QUOTE
On Dec 9, 2003, at 1:24 AM, Tassilo von Parseval wrote:
[..]
hypothetical question,

would one need to be a perl-porter
to write good perl?
[..]

let us get simple.

how about answering the simple question.

it was the core of your alleged argument.

No, it wasn't. Since you are so sure about it, maybe you just quote the
relevant parts of what I wrote instead of making wild assumptions.

The core of my statement was that Perl wouldn't be Perl as we know it if
there hadn't been some people with academic backgrounds working on its
core. This was a direct reply to your claim that academic education is
essentially useless.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.t$&."'!#+sexisexiixesixeseg;y~n~~dddd;eval

Robert Brown
Wiggins d Anconia writes:
QUOTE


please let's do a split(/s/, "Perl Programmer").

this return one array with two scalar:
Perl
Programmer

that's why


Back to semantics, define "Programmer".  Your definition of programmer,
if it requires any knowledge of UML, is so strict that it will not work
in 99% of circles where the term is thrown around *today*. Admittedly I
have very little knowledge of UML, but my employer seems very happy with
my abilities as a "programmer", and from what little I have seen and
read around the subject UML is a colossal waste of time on any "real"
programming project.

UML does not help you program; it helps you design. UML is a
diagramming tool to help you think about the relationships between
verious things that could make up a system. It is a way to view the
big picture. Typical UML shows the relationships and data flow
between many computers and many programs and the data flowing between
them all. That does indeed turn out to be pretty useless when you are
trying to code an optimal loop to perform efficiently inside one of
those programs. When people abuse UML to the point of trying to
express line-by-line details of a single program in UML, they need to
be slapped!

I do not write UML, but I can read it, and use the diagrams to discuss
how a system design might be improved. It has proved very helpful to
me on the few projects where the chief architect has used it properly.
I come from the "old school", having written my first program in
1967. I use any informal diagramming technique that helps me
visualize and think about the problem at hand. This helps me a lot,
but sometimes other people do not understand what I mean in these ad
hoc diagrams. UML is an attempt to standardize the diagramming
conventions to achieve protability among system architects.

I remember having to throw out the idea of classical flow charts when
I started writing context switching code for operating system
internals in 1973. The classical flow chart could not capture the
idea of parallelism. Of course, that was back in the "good old days",
when I had 8K 16 bit words of real magnetic core memory and a 2.5
microsecond cycle time -- translates to 32 KB main memory and 0.4 MHz
on a 16 bit machine,and everything was coded in assembler. The
smallest machine I ever programmed was 1 KB or ROM and 64 bytes of
RAM; that was for a robotic tool that worked inside of a sewer pipe in
1982. Today I work on little PC's that have half a terabyte of disk,
several gigabytes of RAM, and run at several GHz. They are networked
together and function as a single system. In the words of Sun, "The
network *IS* the computer!" Hardware guys make progress much easier
than software guys.

As we encounter new problems, we find that we need new tools to think
about them. UML is a pretty good "formal" tool right now, but don't
ever think that is is the end-all. I still like my informal diagrams
for brainstorming. The formalizers can convert them into UML for the
system documentation. They need to, as I will probably be long gone
(I am a consultant) before some maintenence programmer read the docs
when trying to fix some nasty bug. He needs to be able to understand
the diagrams too, so formalization is necessary for portability
between people who never get to communicate with each other any other
way.

--
-------- "And there came a writing to him from Elijah" [2Ch 21:12] --------
R. J. Brown III [Email Removed] http://www.elilabs.com/~rj voice
Elijah Laboratories Inc. 457 Signal Lane, Grayslake IL 60030 fax
----- M o d e l i n g t h e M e t h o d s o f t h e M i n d ------

Wiggins D Anconia
QUOTE
please let's do a split(/s/, "Perl Programmer").

this return one array with two scalar:
Perl
Programmer

that's why


Back to semantics, define "Programmer". Your definition of programmer,
if it requires any knowledge of UML, is so strict that it will not work
in 99% of circles where the term is thrown around *today*. Admittedly I
have very little knowledge of UML, but my employer seems very happy with
my abilities as a "programmer", and from what little I have seen and
read around the subject UML is a colossal waste of time on any "real"
programming project.

http://danconia.org

--
Boycott the Sugar Bowl! You couldn't pay me to watch that game.

Bob Showalter
Dan Anderson wrote:
QUOTE
On Tue, 2003-12-09 at 16:31, James Edward Gray II wrote:
On Dec 9, 2003, at 3:19 PM, Dan Anderson wrote:

I have 2 Linux boxes I want to talk to each other over the local
network using a Perl script.  Is it possible to set up a
bidirectional pipe so that 2 perl daemons can communicate with
each other?  How would I go about doing this and are there any
modules to help?

You're talking about a TCP connection, which is bidirectional.

QUOTE

It's very possible and there are many modules to help. Help us help
you though, what are you trying to do?  It could make a big
difference.

I'm writing a perl daemon to do two things: back up important files on
multiple boxen so if one gets taken out another will survive, and sync
files in users directory from a main server -- i.e. I want to
be able to
do something like $ ./distribute.pl --file and have it sent to all
boxen's ~/distributed/ directory.

You might look at the standard rdist(1) utility for this kind of thing.

For crafting network daemons in Perl, Net::Daemon is a good place to start,
IMO.


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.