JOIN problem ? (2nd attempt to post)

S

stu7

+ (I posted this the other day, but it seems to have
dissappeared).

Using my older version of Perl (5.08 ?), the JOIN
command produces what appears to be more like a HASH
than the ordered list I fed it... for instance;

@fruitz = join "apple","bananna","cherry" ;

...does in fact produce a joined string, but the elements
are NEVER in the original order,

- more often, this would come out: apple cherry bananna
when printed ...suggesting to me that, at least this older
version of Perl, that JOIN used a HASH to save the results.
That seems a little odd_ but really, my question is,
IS this what the JOIN command always does, or is it fixed
or changed in later versions of Perl, 5.6 or later ?
 
A

A. Sinan Unur

(e-mail address removed) (stu7) wrote in
+ (I posted this the other day, but it seems to have
dissappeared).

Using my older version of Perl (5.08 ?), the JOIN
command produces what appears to be more like a HASH
than the ordered list I fed it... for instance;

@fruitz = join "apple","bananna","cherry" ;

Take a look at the documentation for join:

join EXPR,LIST
Joins the separate strings of LIST into a single string with
fields separated by the value of EXPR, and returns that new
string. Example:

$rec = join(':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);

Beware that unlike "split", "join" doesn't take a pattern as its
first argument. Compare "split".

you should see that join returns a single string in scalar context.

Now, the first argument to join is taken to be the field separator you
want to use. Hence:

my $fruitz = join "apple","bananna","cherry" ;
print $fruitz;

yields:

banannaapplecherry

because you have told Perl you want to have banana and cherry separated
by apple.

Now, by assigning the return value of join to an array you are creating
an array with the single element "banannaapplecherry".
- more often, this would come out: apple cherry bananna
when printed ...

That sounds impossible to me.
That seems a little odd_ but really, my question is,
IS this what the JOIN command always does, or is it fixed
or changed in later versions of Perl, 5.6 or later ?

I don't see what needs to be fixed other than your code. If you just want
to join "apple","bananna" and "cherry" with no separators in between, use

join "", "apple","bananna","cherry" ;

Sinan.
 
J

Jeff 'japhy' Pinyan

[posted & mailed]

Using my older version of Perl (5.08 ?), the JOIN
command produces what appears to be more like a HASH
than the ordered list I fed it... for instance;

@fruitz = join "apple","bananna","cherry" ;

First of all, join() returns a scalar. Why are you storing ONE scalar in
an array? It's not "wrong", it's just suspect. I don't think you're
doing what you think you're doing.

Second, you've left out the first argument to join(), which is the string
with which to join the other strings.

print join " -- ", qw( apple banana cherry );
# apple -- banana -- cherry
 
S

stu7

Jeff 'japhy' Pinyan said:
First of all, join() returns a scalar. Why are you storing ONE scalar in
an array? It's not "wrong", it's just suspect. I don't think you're
doing what you think you're doing.

Second, you've left out the first argument to join(), which is the string
with which to join the other strings.

print join " -- ", qw( apple banana cherry );
# apple -- banana -- cherry

*** Ya... I had not read about this first argument to JOIN...
*** thanks to pinyaj and the others who told me about overlooking this.
*** Saving to an array was my natural instinct, given the original
*** list of three... a simple scalar would certainly be a good
*** suggestion here instead.
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(e-mail address removed) (stu7) wrote in
*** Ya... I had not read about this first argument to JOIN...
*** thanks to pinyaj and the others who told me about overlooking this
*** Saving to an array was my natural instinct, given the original
*** list of three... a simple scalar would certainly be a good
*** suggestion here instead.

Just a friendly tip: Please don't start every line of your post with
"***" or any other character. Longstanding Usenet tradition is that you
precede text lines with one or more characters like that when you're
quoting someone else's text. Many newsreader programs highlight text
differently if there's a leading string like your "***". I had to read
your article twice to find your response.

- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPxkzWGPeouIeTNHoEQI4SgCfUyiKy/p2/gwCBaszRO7NGCgErtMAn0T9
RR5vzhu/02SiEJsfRGipAoSd
=49+l
-----END PGP SIGNATURE-----
 
S

stu7

*** No thanks to you Eric... not that usenet isn't plagued
*** with meaningless posts already - and your's fits right in...
*** however, to answer your "friendly post" -
*** A) Usenet is here, among a very few other reasons, so people
*** with legitimate questions can get answers from those who
*** already have encountered these problems... your post had
*** virtually nothing to do with my questions - which were, in
*** fact, answered politely and correctly by two posters previous
*** to your "style whine"_ value of your spam is ? (right... nothing).
***
*** B) If using my quoting style fouls up your newsreader, then,
*** I feel as though I have contributed something extra. Kindly
*** dont bother spamming people on these newsgroups again.
***
*** C) If you really feel a need to get your snaz signature and
*** puffy whines plastered all over the net, why not start your own
*** newsgroup... why not start it on your own computer... then you
*** you could have TOTAL control, ey ? :)
 
S

Sam Holden

*** No thanks to you Eric... not that usenet isn't plagued
*** with meaningless posts already - and your's fits right in...
*** however, to answer your "friendly post" -
*** A) Usenet is here, among a very few other reasons, so people
*** with legitimate questions can get answers from those who
*** already have encountered these problems... your post had
*** virtually nothing to do with my questions - which were, in
*** fact, answered politely and correctly by two posters previous
*** to your "style whine"_ value of your spam is ? (right... nothing).

The chances of any of your legitimate questions being seen by the
very people who probably know the answers is quite slim now.

[snip a post that breaks almost all the conventions of clpm]
 
J

Jeff 'japhy' Pinyan

[posted & mailed]

*** No thanks to you Eric... not that usenet isn't plagued
*** with meaningless posts already - and your's fits right in...
*** however, to answer your "friendly post" -

Well then, let me "plague" usenet with this post as well.

You're not being very polite at all. Eric is someone who helps out on
this list quite often. You're asking for help from people who are giving
their time free of charge (many people who give help on this list make
money doing consulting). Be grateful, please.
*** A) Usenet is here, among a very few other reasons, so people
*** with legitimate questions can get answers from those who
*** already have encountered these problems... your post had
*** virtually nothing to do with my questions - which were, in
*** fact, answered politely and correctly by two posters previous
*** to your "style whine"_ value of your spam is ? (right... nothing).

Do you know what "netiquette" is? If not, you should probably research
it. You're being awfully rude to Eric. He offered a polite suggestion.
If you're asking people to help you, you should try to do as they ask.
Make it as easy as possible for them to help you. This includes things
like bottom-posting, proper quoting and trimming, and general attitude.

(You top-posted, didn't trim the unnecessary parts from Eric's response,
and display poor attitude.)
*** B) If using my quoting style fouls up your newsreader, then,
*** I feel as though I have contributed something extra. Kindly
*** dont bother spamming people on these newsgroups again.

Huh? If I write a program that crashes your OS, or deletes files, I don't
think I've "contributed something extra". I think I've made a mistake, or
have caused mischief. I apologize and try to correct the problem. And
anyone else who happens to see Eric's post now has the opportunity to
correct their own posting style if they notice it might cause problems.

You get more help if you're nice. People are liable to killfile you and
not help you if you have a bad attitude.
*** C) If you really feel a need to get your snaz signature and
*** puffy whines plastered all over the net, why not start your own
*** newsgroup... why not start it on your own computer... then you
*** you could have TOTAL control, ey ? :)

A quick google search reported at least 1230 postings by Eric on the
newsgroup. He's helping people. Trust me. He's not trying to get his
signature everywhere he can.

In closing, act politely, try not to piss off the people you're asking for
help, and accept criticism. Then perhaps you'll get a better reception
here.
 
M

Martien Verbruggen

*** No thanks to you Eric... not that usenet isn't plagued
*** with meaningless posts already - and your's fits right in...
*** however, to answer your "friendly post" -
*** A) Usenet is here, among a very few other reasons, so people
*** with legitimate questions can get answers from those who
*** already have encountered these problems... your post had
*** virtually nothing to do with my questions - which were, in
*** fact, answered politely and correctly by two posters previous
*** to your "style whine"_ value of your spam is ? (right... nothing).

You obviously have no clue, and are not willing to get one.

*plonk*

Martien
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(e-mail address removed) (stu7) wrote in
*** A) Usenet is here, among a very few other reasons, so people
*** with legitimate questions can get answers from those who
*** already have encountered these problems... your post had
*** virtually nothing to do with my questions - which were, in
*** fact, answered politely and correctly by two posters previous
*** to your "style whine"_ value of your spam is ? (right... nothing).

What the hell is this? All I was doing what pointing out, in a
neighborly sort of way, that your post breaks many of the longstanding
conventions of Usenet, and what to do about that. Ignoring these
conventions is generally considered rude. I was trying to help you not
appear rude.

It would seem that you are bent on being rude anyhow.

*** B) If using my quoting style fouls up your newsreader, then,
*** I feel as though I have contributed something extra. Kindly
*** dont bother spamming people on these newsgroups again.

Your quoting style does not in fact foul up my newsreader. I was
pointing out that your style will be a problem for many other
newsreaders. It wasn't a personal gripe.

*** C) If you really feel a need to get your snaz signature and
*** puffy whines plastered all over the net, why not start your own
*** newsgroup... why not start it on your own computer... then you
*** you could have TOTAL control, ey ? :)

"Puffy whines"? What, you think that the tips I gave to you are my own
personal preferences? "Netiquette" is the cumulative, cultural buildup
of social rules and conventions on Usenet over the decades. This is not
a pissing contest between my personal style and yours. You're in a
foreign country and you're spitting on the sidewalk, leaving toilet paper
on the floor, crossing the street against the light.

You apparently have no clue what "netiquette" is, nor do you apparently
care. Your smiley does not soften how you come across.

- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPxocsWPeouIeTNHoEQI7EgCfZhTC7eCtYpPDY7OGO07Fg9rQShoAn2WA
S69qtUpd22Ge/lBLqHBRzxfs
=uoOU
-----END PGP SIGNATURE-----
 
J

Jürgen Exner

stu7 said:
*** No thanks to you Eric... not that usenet isn't plagued
*** with meaningless posts already - and your's fits right in...
*** however, to answer your "friendly post" -
[rest of top-posted, fullquoted, unreadable quoting style whining of
clueless learning-resistant ignorant snipped]

*PLONK*

jue
 
T

Tad McClellan

Abigail said:
Sam Holden ([email protected]) wrote on MMMDCX September
MCMXCIII in <URL::) On 19 Jul 2003 18:40:43 -0700, stu7 <[email protected]> wrote:
:) > *** No thanks to you Eric...
:) > *** your post had
:) > *** virtually nothing to do with my questions


First, there is no requirement that followups address any
question that was asked. This is a _discussion_ newsgroup.
People post things, and we discuss them.

Sometimes the discussion leads to an answer to a question.

Sometimes is doesn't.



Second, there was no technical value in Eric's followup, but
there was a great deal of _social_ value in it.

The answer to your question was a short-term transient thing,
it a few minutes/hours/days it has been solved.

The topic of Eric's subthread was long-term, it would have
served you well even years from now.

:) > *** to your "style whine"_ value of your spam is ? (right... nothing).


The value was that, if you had followed netiquette, you could
have avoided that very last entry below...

:) [snip a post that breaks almost all the conventions of clpm]


I've been killfiling everything coming from an hotmail account for
many years, and I've never regret it.


I became a "domainist" about 3 years ago and have never looked back.

Only I just "score down" rather than "kill", and I only
score down "most everything".

I don't even read the Subject lines below a score of -9000, and
I rarely have time to read those that are below -5000.



% wasteland domains
Score:: -9000
From: aol\.com
From: msn\.com

% silly domains
Score:: -1000
From: hotmail\.com
From: yahoo\.com
From: dbforums.com

% exceptions for silly domains
Score:: +1000
< a few regular posters who use hotmail... >


...


% anti-FAQers, anti-netiquette, usenet abusers
Score:: -9998
From: (e-mail address removed)
 
T

Tad McClellan

stu7 said:
*** B) If using my quoting style fouls up your newsreader, then,
^^^^^^^^^^^^^^^

It fouled up *hundreds* of newsreaders around the world...

*** I feel as though I have contributed something extra.


.... and you are proud(!) of that?

*** dont bother spamming people on these newsgroups again.


We can tell who is concerned about good manners and who isn't.

Can you?
 
C

Chris Mattern

Tad said:
% wasteland domains
Score:: -9000
From: aol\.com
From: msn\.com

No webtv.com? Well, I suppose it is msntv.com now,
and in any any case, they were always too clueless
to even *find* Usenet....

Chris Mattern
 
S

stu7

Uri Guttman said:
s> *** ...sets out a bowl of sugar water, to attract more ***
s> style-spammers

nah, you just made sure no one would help you by your attitude. i don't
kill file but your posting style makes it easy for me to ignore you. try
to get help here and you probably will not get it except from the
newbies or clueless who don't know you yet.

uri

*** Uri... you missed it. I got my answer already.
*** There was no attitude... I asked a simple question, and
*** got a quick answer.
***
*** What I took issue with was the large group of people
*** who waste their time here style-critiquing every legitiamate
*** question that is asked... why should I be friendly
*** toward this unappreciated practice ?
*** You seem divided on whether to support those who ask
*** legitimate questions, or those who choose to harangue them.
***
*** I dont care, really, one way or the other. Im sorry, but
*** your name calling insulting post isnt legitimatized by
*** any responsibilty you feel you might have here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top