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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with search 1

Status
Not open for further replies.

LotoL

Programmer
Mar 17, 2004
20
CA
Hi, Im getting this error..

Can't modify constant item in scalar assignment at ./pattern_search1.1 line 12, near """)"


here is my code:
print ("Enter the search pattern:\n");
$pattern = <STDIN>;
chop ($pattern);

open(FILENAME, "/home/x1207/GetNode/listdb.txt");

print ("Matches found:\n");

while (FILENAME = "")
{
if (FILENAME =~ /$pattern/)
{
print ("found database $pattern\n");
} else {
print ("can not find database $pattern\n")
}

}
close (FILENAME);
~
 
Try this:
Code:
while (<FILENAME>)
  {
     if (/$pattern/)
       {
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top