Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2018-10-23 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (126 votes). Check out past polls.

    Notices?