Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. my $filename = "students.csv";
  7. open (STUDENTS,$filename) || die "Cannot Open '$filename'";
  8.  
  9. # get column names
  10. my $line = <STUDENTS>;
  11. chomp($line);
  12. my @column_names = split(",",$line);
  13.  
  14. print "Printing Student ${column_names[1]}s...n";
  15.  
  16. # get all names
  17. while($line = <STUDENTS>){
  18. chomp($line);
  19. (my $id,my $name) = split(",",$line);
  20. print "$namen";
  21. }
  22.  
  23. #--------------------------------------------------------
  24. # documentation
  25. #
  26.  
  27.  
  28. =head1 NAME
  29.  
  30. Print Student Names
  31.  
  32. =head1 SYNOPSIS
  33.  
  34. chmod a+x ./csvread.pl
  35. ./csvread.pl
  36.  
  37. =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement