Thursday, February 22, 2007

Assignment #6

As last week was the first time I ever came in contact with Perl, I didn't understand this assignment. I spent far too long searching the Internet looking for help, only to come up with a half working Part 1. In turn I don't have anything for part two or three. Something isn't clicking for me yet, hopefully I will catch on soon.

Part 1 (Working, but incomplete code)

# 6.pl
# Reads characters


print "What file?";
$a = <STDIN>
chop $a;

#opens file
open (FILE, "$a") or die "File Missing. Find It!!";


while ($record =
<FILE>) {
print "This file has ", length($record), " characters!";

#makes each printed line on a seperate line
print "$record[-10]\n";

}

close(FILE);

No comments: