perl 5.0 alpha 8
[p5sagit/p5-mst-13.2.git] / Bugs / arraynotok
1 #!/usr/bin/perl
2
3 #
4 # I thought that I would try out some perl 5 features for the first time.
5 # So I wrote a small program, included below.  It died, and the partial
6 # output looks very much like what I wanted to accompish.  Even if the program
7 # had not died, there is still the problem that no output was given under the
8 # label "sonia:".
9 #
10 # Since the output is close, perhaps a bug lurks within...(?)  I'm using the
11 # compiled binary provided in the perl5a6 tar file.  I tried to write this
12 # post so it could be given to perl with the -x flag.  You should get the
13 # output I describe here --
14 #                                                      James Bence
15 #                                                      jbence@math.ucla.edu
16 #
17 # Output:
18 #
19 # Pushed ege into @sonia
20 # Pushed caflisch into @joshua
21 # Pushed catalina into @julia
22 # Pushed lunnon into @sonia
23 # Pushed m270alg into @redwood
24 # Pushed harten into @joshua
25 # Pushed ycc into @joshua
26 # Pushed m270wsc into @redwood
27
28
29 # joshua:
30 #     caflisch harten ycc 
31
32 # sonia:
33 #     
34
35 # redwood:
36 #     m270alg m270wsc 
37
38 # julia:
39 #     Segmentation fault
40
41 #
42
43 require 5.000;
44
45 while (<DATA>) {
46     ($login,$host) = split;
47     push(@{$hostref{$host}},$login);  # t/op/ref.t (22) suggests this is ok.
48     print "Pushed $login into \@$host\n";
49 }
50
51 print"\n\n";
52
53 while ( ($host,$ref) = each(%hostref)) {
54     print "$host:\n    ";
55     $count = 0;
56     foreach $person (@{$ref}) {
57         print $person, " ";
58         $count++;
59         if ($count % 5 == 0) { print "\n    "; }
60     }
61     print "\n\n";
62 }
63
64 __END__
65 ege         sonia
66 caflisch    joshua
67 catalina    julia
68 lunnon      sonia
69 m270alg     redwood
70 harten      joshua
71 ycc         joshua
72 m270wsc     redwood