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: Intermediate:
Post deleted by mkeith123

 

First page Previous page 1 2 Next page Last page  View All


mkeith123
Novice

Mar 27, 2008, 1:12 PM

Post #1 of 30 (5741 views)
Post deleted by mkeith123

 


KevinR
Veteran


Mar 28, 2008, 1:19 AM

Post #2 of 30 (5737 views)
Post deleted by KevinR [In reply to]

 


mkeith123
Novice

Mar 28, 2008, 9:36 AM

Post #3 of 30 (5733 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Mar 28, 2008, 10:35 AM

Post #4 of 30 (5731 views)
Post deleted by KevinR [In reply to]

 


mkeith123
Novice

Mar 28, 2008, 10:56 AM

Post #5 of 30 (5730 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Mar 28, 2008, 11:00 AM

Post #6 of 30 (5728 views)
Re: [mkeith123] loop [In reply to] Can't Post

Mike,

'path/to/outfile' is a generic example, substitue whatever is appropriate. If you want to write the output in the same directory the script runs in just use a filename with no path:

'outfile.txt'

or whatever you want to call the file.
-------------------------------------------------


mkeith123
Novice

Mar 28, 2008, 2:52 PM

Post #7 of 30 (5723 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Mar 28, 2008, 10:19 PM

Post #8 of 30 (5721 views)
Re: [mkeith123] loop [In reply to] Can't Post

You are only using the name of the file you want to read ($current_file):

open ($IN, $current_file) or die "$!";

so that file would have to be in the same directory as the script or you have to change directory to the directory where to $current_file resides or use the full path to the file:

open ($IN, "path/to/$current_file") or die "$!";

Also, in your first post in this thread, the filename has an underscore in it but in the code you posted there is no underscore in the filename. So remove the underscore in this line if it should not be there:

my $current_file = sprintf "mv_%07d.txt", $file;
-------------------------------------------------


(This post was edited by KevinR on Mar 28, 2008, 10:22 PM)


mkeith123
Novice

Mar 29, 2008, 10:17 AM

Post #9 of 30 (5716 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Mar 30, 2008, 9:42 PM

Post #10 of 30 (5696 views)
Re: [mkeith123] loop [In reply to] Can't Post

Mike, I don't know the answers to those questions. You have to try and figure out where your files are and where the perl script is and such. The "my" does belong there.
-------------------------------------------------


mkeith123
Novice

Apr 1, 2008, 8:49 AM

Post #11 of 30 (5680 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Apr 1, 2008, 10:22 AM

Post #12 of 30 (5679 views)
Post deleted by KevinR [In reply to]

 


mkeith123
Novice

Apr 2, 2008, 1:00 PM

Post #13 of 30 (5667 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Apr 2, 2008, 1:52 PM

Post #14 of 30 (5666 views)
Re: [mkeith123] loop [In reply to] Can't Post

just declare it with "my" on this line:

my $current_file = sprintf "mv_%07d.txt", $file;

that will take care of the error message you are getting.
-------------------------------------------------


mkeith123
Novice

Apr 5, 2008, 12:01 PM

Post #15 of 30 (5617 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Apr 5, 2008, 1:38 PM

Post #16 of 30 (5616 views)
Re: [mkeith123] loop [In reply to] Can't Post

Mike,

I don't really know why you are seeing that path. That is not the directory where your perl script is? Post the full text of the error message.
-------------------------------------------------


mkeith123
Novice

Apr 6, 2008, 12:04 PM

Post #17 of 30 (5603 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Apr 6, 2008, 2:06 PM

Post #18 of 30 (5598 views)
Re: [mkeith123] loop [In reply to] Can't Post

My guess is that Dzsoft has confused the process somehow. I would try putting the Calc6.pl script and the Comparison.txt file in a known directory and run the perl script from the known directory. Something simple like:

c:\test\Calc6.pl

Also, I think Dzsoft is for perl based CGI scripts, your program is not a CGI script, it is a command line script. That probably explains the warning.
-------------------------------------------------


mkeith123
Novice

Apr 10, 2008, 4:00 PM

Post #19 of 30 (5585 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Apr 10, 2008, 11:06 PM

Post #20 of 30 (5580 views)
Re: [mkeith123] loop [In reply to] Can't Post

They just mean to print the value of that variable at that point in the script but we already know what that value will be. It was as I thought, DZSoft is confusing the process. I think all IDE's work like that, they create a temp file of the script so you can edit and run it dynamically without first having to save it to hard disk. All you have to do to avoid the problem is do what I said, save the script to a known directory and run it from there.

The question right now is are you sure the files in:

C:/UnzippedDownloads/training_set/

are named how you say they are:

mv_0000001.txt) to (mv_0017700.txt)

change this line:


Code
open (my $IN, "C:/UnzippedDownloads/training_set/$current_file") or die "$!";

to:

Code
open (my $IN, "C:/UnzippedDownloads/training_set/$current_file") or die "$current_file: $!";


and see which value of $current_file can't be found.
-------------------------------------------------


mkeith123
Novice

Apr 11, 2008, 8:23 AM

Post #21 of 30 (5575 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Apr 11, 2008, 3:18 PM

Post #22 of 30 (5572 views)
Re: [mkeith123] loop [In reply to] Can't Post

if you mean this line:

<$IN>; #<-- skips first line

it will only skip the first line of the file. But remove it if you want to.
-------------------------------------------------


mkeith123
Novice

Apr 12, 2008, 9:50 AM

Post #23 of 30 (5557 views)
Post deleted by mkeith123 [In reply to]

 


KevinR
Veteran


Apr 12, 2008, 1:32 PM

Post #24 of 30 (5552 views)
Re: [mkeith123] loop [In reply to] Can't Post

attach (not post) one of the $current_file files to a post and i will take a look at it.
-------------------------------------------------


mkeith123
Novice

Apr 13, 2008, 9:26 AM

Post #25 of 30 (5538 views)
Post deleted by mkeith123 [In reply to]

 

First page Previous page 1 2 Next page Last page  View All
 
 


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

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