Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- my $filename = "students.csv";
- open (STUDENTS,$filename) || die "Cannot Open '$filename'";
- # get column names
- my $line = <STUDENTS>;
- chomp($line);
- my @column_names = split(",",$line);
- print "Printing Student ${column_names[1]}s...n";
- # get all names
- while($line = <STUDENTS>){
- chomp($line);
- (my $id,my $name) = split(",",$line);
- print "$namen";
- }
- #--------------------------------------------------------
- # documentation
- #
- =head1 NAME
- Print Student Names
- =head1 SYNOPSIS
- chmod a+x ./csvread.pl
- ./csvread.pl
- =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement