[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] I have a question...



A little background about myself before the rest of you laugh at my problem.
I am a 19 year old without much background in programming, trying to teach
myself MacPerl as my *FIRST* programming/scripting language, while going to
college for an associates in programming.  First of all, I was wondering if
there was a beginner or intermediate mailing list for MacPerl, and if there
are beginners who have made some scripts that other beginners could use as
examples for their learning?  Anyways, I have tried to teach myself to open
files and write to files this past weekend.  I learned how to open files after
about five hours at looking at the same example over and over.  This is the
first time I have tried to write a file and then open it.  Here is my script
so far.

###########

#!/usr/bin/perl  -w

#I am experiment with writing to files.
 
require 'StandardFile.pl';

open(OUT, '>hello.txt') or die "The file  hello.txt could not be written
to.\n";
{ print OUT "\t Hello, I don't think this works.\n"; }
close (OUT);

print "\t Would you like to go get the file that you just created?\t";
$gf = <STDIN>;
chomp $gf; 
if (($gf eq "y") or ($gf eq "Y") or ($gf eq "yes") or ($gf eq "Yes")) {
			print "\n";
   print "\t Just type in 'get' to find the file, hello.txt\t"; print "\n";
   print "\t Remember it is in, Hard Disk:Perl User:Open File Projects:Writing
Files:hello.txt\t";
   print "\n";
			print "\n";
			print "\t Type here -\t";
			$th = <STDIN>;
			chomp $th;
			
   if ($th eq "get") {  
			     
        $InFile = StandardFile::GetFile(); 
        open (INPUT, $InFile);
			     while (<INPUT>) { print $_ }
   }

} else { print "\t I guess you don't want to get the file that you just
created\n"; }

#######
And it works just fine, except that it gives me these errors:

# Use of uninitialized value, <STDIN> chunk 2.
File ':StandardFile.pl'; Line 38
# Use of uninitialized value, <STDIN> chunk 2.
File ':StandardFile.pl'; Line 42
# Use of uninitialized value, <STDIN> chunk 2.
File ':StandardFile.pl'; Line 48
# Use of uninitialized value, <STDIN> chunk 2.
File ':StandardFile.pl'; Line 48


Which I don't understand completely, because the script doesn't even have 38
lines.  Can you help me here?  What am I doing wrong?  Have I not declared a
variable with StandardFile.pl?

Just in case you ask, I have the MacPerl application, StandardFile.pl, and
GUSI.ph in the directory that I tell the person running the script to get
hello.txt

Also, after all of those errors, the script lets me get the file, and opens it
just fine, displaying the text.

Please help!!!

Mat Landers

-A beginner who bows down to the gods of MacPerldom-

P.S.   I'm sorry that you have to read such sloppy code, but remember i'm just
a beginner....

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch