questions and understanding

DBSMITH_at_OhioHealth.com
Date: 06/30/04


To: beginners@perl.org
Date: Wed, 30 Jun 2004 09:44:26 -0400

All,

I was playing with my code and after re-reading perdoc perlre, I still do
not understand the items in yellow and their need.

here is my code.

open(F,"$ARGV[0]") || die "*** face: $!\n";
$i=0;
print "-w '";
#print $i;
while (<F>) {
chomp($_);
        if ($i > 0) {
                print " or ";
        }
        $i++;
print "barcode=\"$_\" ";
}
print "\'\n";

I will start from the bottom up:

Why do I need or what is the significance of print "\ ' \n"; I really do
not need the first \ !

At line print barcode it seems that do need the \ "$_\" "; as when I take
the \'s away I get these errors which I am not understanding:

Scalar found where operator expected at parse_for_ejects.pl line 11, near
""barcode="$_"
        (Missing operator before $_?)
String found where operator expected at parse_for_ejects.pl line 11, near
"$_" ""
        (Missing operator before " "?)
syntax error at parse_for_ejects.pl line 11, near ""barcode="$_"
parse_for_ejects.pl had compilation errors.

help in explaining.

thanks,

derek

Derek B. Smith
Ohiohealth IT
UNIX, EDM, TSMSupport


Quantcast