Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Continuation of questions (PS - answer here)

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
WesleyWee
Asked:
WesleyWee
  • 3
  • 2
1 Solution
 
wilcoxonCommented:
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
 
WesleyWeeAuthor Commented:
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
 
WesleyWeeAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
moduloCommented:
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
 
WesleyWeeAuthor Commented:
I agree in closing this Question
0
 
moduloCommented:
Saving this Q as a PAQ and refunding the points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now