Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading files

Status
Not open for further replies.

blakee

Programmer
Jan 18, 2005
22
I'm on windows xp pro and useing Active Perl.. When I try to execute this file it has 1 error, 'can't modify in scalar assignment file.pl line 3 near ""test.cgi";"' Heres the .pl:

!#usr/local/bin/perl

$data_file="test.cgi";

open(DAT, "$data_file") || die("Error: Could not open file");
@raw_data=<DAT>;
close(DAT);

foreach $test_cmt (@raw_data)
{
chop($test_cmt);
($t_name,$t_cmot,$t_action)=split(/\|/,$test_cmt);
print "When Test talks to $t_name there is a $t_cmot and does this weird $t_action\n";
}
 
Assuming the code above was copied and pasted, your first line is probably causing the trouble. It should read something similar like:

Code:
#!/usr/local/bin/perl
Acatually, you said this is running on an XP box, you don't need that line at all.

One question, any particuarly reason you're not using strict and warnings?
 
I'd concur, the shebang, while it shouldn't be needed on an XP environment, starting with a ! is not the same as # for indicating a comment.

reading something like
"not operator on comment, but no terminator for not operator which then attempts to negate the scalar assignment"

Not sure but it looks like that

Apache on WinOS still needs the shebang line, IIRC

HTH
--Paul

cigless ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top