in reply to can't open a file?
Here's your script rewritten with strict.. (untested)
#!/usr/bin/perl use strict; open (FILE, 'data.txt'); while (<FILE>) { chomp; my ($name, $email, $phone) = split(/\s/); # split on whitespace print "Name: $name\n"; print "Email: $email\n"; print "Phone: $phone\n"; print "---------\n"; } close (FILE); exit;
|
|---|