?
Solved

Continuation of questions (PS - answer here)

Posted on 2003-03-20
6
Medium Priority
?
173 Views
Last Modified: 2010-03-05
I have a previously asked question on the last comment at

http://www.experts-exchange.com/Programming/Programming_Languages/Perl/Q_20553048.html

It is about how to make open file to be global
0
Comment
Question by:WesleyWee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:wilcoxon
ID: 8181423
I'm not quite sure what you mean by "it is about how to make open file global".  However, I do see some problems with your code from the last comment of the previous thread.

for( @files ) {
if($line = /^.+L1\.UMC$/){$L1_FILE=$_;}
open (FILE, "$L1_FILE") or die $!;
while (<FILE>)

First, I'm not sure what you're trying to do with the "if($line..." statement - it looks fishy to me.  If you're trying to see if $line matches the regex, then it needs to be "if($line =~ ...".  If you're trying something else, please let me know what you're trying to do.  Depending on what you're trying to do, I also don't see anywhere that $line is set (or used) in your code.

Second, $L1_FILE is only being set if the if is true.  You probably don't want to open the file unless the file to be opened changed (or do you want to open the previous $L1_FILE if the "if" fails?).

Generally, I would strongly encourage you to "use strict", "use warnings" (or -w), and (while debugging) "use verbose".
0
 

Author Comment

by:WesleyWee
ID: 8182137
I have included what i need to say in the *pl code in the *zip file attached.

http://www.geocities.com/wwyz83/Perl.zip

Inside the running working code is Gtest.pl
while the one i am testing to change is in Ztest.pl

0
 

Author Comment

by:WesleyWee
ID: 8185166
oh yes there are problems in my code, i believe i copied the wrong code out. but i have attached the new code in the *zip above.

the "if($line..." statement i'm trying to set it to true; searching for the *.L1.UMC file. In the folder that is for checking there will always only be one of such a file. Therefore i require the code to automactically open the the *L1.UMC file.

why is it *L1.UMC?
It is that it's fixed that the characters before L1 is always changing. only fixed is the L1.UMC therefore i want the code jus to open any file that has the name L1.UMC at the back of the filename.

I don't wish to put "ue warnings" or "use strict".
As i am jus a beginner to using Perl and i am having a deadline. i found it hard to run if i keep getting warnings and to keep up with syntx.

I kinda really need to finish my code asap but i can't seem to totally understand everything to create word for word. I'm kinda begging already, i'm sorry. I'm desperate.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:modulo
ID: 8195321
Dear expert(s),

A request has been made to close this Q in CS:
http://www.experts-exchange.com/Community_Support/CleanUp/Q_20560470.html

Without a response in 72 hrs, a moderator will finalize this question by:

 - Saving this Q as a PAQ and refunding the points to the questionner

When you agree or disagree, please add a comment here.

Thank you.

modulo

Community Support Moderator
Experts Exchange
0
 

Author Comment

by:WesleyWee
ID: 8199331
I agree in closing this Question
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 8221454
Saving this Q as a PAQ and refunding the points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question