Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: Nested Data Structures, OOP

by programmer.perl (Beadle)
on Jul 23, 2012 at 14:18 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://983177]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-25 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found