Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add print sort example #7062

Closed
p5pRT opened this issue Jan 25, 2004 · 6 comments
Closed

add print sort example #7062

p5pRT opened this issue Jan 25, 2004 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 25, 2004

Migrated from rt.perl.org#25261 (status was 'resolved')

Searchable as RT25261$

@p5pRT
Copy link
Author

p5pRT commented Jan 25, 2004

From @jidanni

$ perldoc -f sort
  print sort @​harry;
  # prints AbelCaincatdogx
OK, add an example to show how to print
Abel
Cain
cat
dog
x

for my $i (sort @​harry){print $i,"\n"};
I suppose.

@p5pRT
Copy link
Author

p5pRT commented Jan 25, 2004

From @iabyn

On Sun, Jan 25, 2004 at 04​:11​:58PM -0000, Dan Jacobson wrote​:

# New Ticket Created by Dan Jacobson
# Please include the string​: [perl #25261]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=25261 >

$ perldoc -f sort
print sort @​harry;
# prints AbelCaincatdogx
OK, add an example to show how to print
Abel
Cain
cat
dog
x

for my $i (sort @​harry){print $i,"\n"};
I suppose.

Actually, the Unix sort command with the -u ("unique") option deletes
duplicates. So an example would be

  my %harry;
  @​harry{@​harry} = ();
  @​harry = sort keys %harry;

But I'm not convinced that perlfunc.pod needs that adding to it.

--
My get-up-and-go just got up and went.

@p5pRT
Copy link
Author

p5pRT commented Jan 25, 2004

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jan 25, 2004

From @iabyn

On Sun, Jan 25, 2004 at 05​:37​:34PM +0000, Dave Mitchell wrote​:

On Sun, Jan 25, 2004 at 04​:11​:58PM -0000, Dan Jacobson wrote​:

# New Ticket Created by Dan Jacobson
# Please include the string​: [perl #25261]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=25261 >

$ perldoc -f sort
print sort @​harry;
# prints AbelCaincatdogx
OK, add an example to show how to print
Abel
Cain
cat
dog
x

for my $i (sort @​harry){print $i,"\n"};
I suppose.

Actually, the Unix sort command with the -u ("unique") option deletes
duplicates. So an example would be

my %harry;
@&#8203;harry\{@&#8203;harry\} = \(\);
@&#8203;harry = sort keys %harry;

But I'm not convinced that perlfunc.pod needs that adding to it.

Gack. Just realised I replied to a separate bug report and not a follow-up
to the first sort -u one.

Why on earth does the sort documentation need to show different ways to
print out a list?

--
Any [programming] language that doesn't occasionally surprise the
novice will pay for it by continually surprising the expert.
  -- Larry Wall

@p5pRT
Copy link
Author

p5pRT commented Jan 29, 2004

From @jidanni

Dave> Why on earth does the sort documentation need to show different ways to
Dave> print out a list?

Well you must admit that the current example, which glues all the
results together, would be very less what the first time user probably
wants to do.

@p5pRT p5pRT closed this as completed Feb 1, 2004
@p5pRT
Copy link
Author

p5pRT commented Feb 1, 2004

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant