CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Stefanik] Match string in multi-line file: Edit Log



Stefanik
User

Dec 30, 2012, 7:27 AM


Views: 4166
Re: [Stefanik] Match string in multi-line file

I've added the strings at the begin, with following error:


Code
Global symbol "$FileToParse" requires explicit package name at BatchParser.pl line 8. 
Global symbol "$FileParsed" requires explicit package name at BatchParser.pl line 11.
Global symbol "$FileToParse" requires explicit package name at BatchParser.pl line 29.
....
Execution of C:\Users\ADS\Desktop\Perl_Test\BatchParser.pl aborted due to compil
ation errors.


So, I expilcit the input file in the same block command of my execution code (I don't have different function, just a serie of line code). In this way I get following errors:


Code
Global symbol "$FileTemp" requires explicit package name at BatchParser_2.pl line 7. 
Global symbol "$FileTemp" requires explicit package name at BatchParser_2.pl line 8.
syntax error at BatchParser_2.pl line 8, near "){"
Global symbol "$FileTemp" requires explicit package name at BatchParser_2.pl line 9.
Global symbol "$FileTemp" requires explicit package name at BatchParser_2.pl line 10.
syntax error at BatchParser_2.pl line 12, near "}"
Execution of BatchParser_2.pl aborted due to compilation errors.


And I don't understand the reason. Frown

Here the code:

Code
 
use strict;
use warnings FATAL => qw(all);

my $FileToParse="C:/Users/Me/Desktop/Perl_Test/temp/File.log";
open (PARSEFILE, "<", $FileToParse) or die "No file!!!";
$FileTemp="x"
while ($FileTemp = <PARSEFILE>){
$FileTemp =~ s/:/\n/g;
my $value1 = (/^STRING,\w+(\w+)/), $FileTemp;
print $value1;
}
close (PARSEFILE);



(This post was edited by Stefanik on Dec 30, 2012, 7:29 AM)


Edit Log:
Post edited by Stefanik (User) on Dec 30, 2012, 7:29 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives