Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Nested Data Structures, OOP

by programmer.perl (Beadle)
on Jul 23, 2012 at 14:18 UTC ( #983177=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print "Enter the student's course(s) ";
    $self->{"Course(s)"}=[<STDIN>]
    
  2. or download this
    print "Enter the student's course(s) delimiting 
    them with a comma (,) ";
    ...
     $cour =~ s/\s+//g;
     my @cour = split(",", $cour);
     chomp($self->{"Course(s)"}->{"cour"}=[@cour]);
    
  3. or download this
    sub add_courses {
      my $self = shift;
    ...
      for ($i=0; $i<$num; $i++) {
       push @{$self->{'Course(s)'}->{'cour'}}, $courses->[$i];
    }
    
  4. or download this
    Here are the statistics for the Sino.
    Address: kk
    ...
    Tuition: kk
    Course(s): Chem, Bio, Maths, C++, Java
    After dropping: Chem, Bio, Maths, , Java
    
  5. or download this
    package Student3;
    sub new { my $class = shift;
    ...
       join (", ", @{$self->{'Course(s)'}->{'cour'}}), "\n";
    }
    1;
    
  6. or download this
    #!/usr/bin/perl -w
    use Student3;
    ...
    $student1->add_courses(["C++", "Java"]);
    $student1->show_student;
    $student1->drop_courses(["C++"]);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983177]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2018-07-16 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (330 votes). Check out past polls.

    Notices?