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

Home: Perl Programming Help: Intermediate:
Post deleted by mkeith123

 1 2  View All Print Thread

mkeith123
Novice

Mar 27, 2008, 1:12 PM

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

KevinR
Veteran

Mar 28, 2008, 1:19 AM

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

mkeith123
Novice

Mar 28, 2008, 9:36 AM

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

KevinR
Veteran

Mar 28, 2008, 10:35 AM

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

mkeith123
Novice

Mar 28, 2008, 10:56 AM

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

KevinR
Veteran

Mar 28, 2008, 11:00 AM

Post #6 of 30 (15628 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 (15623 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Mar 28, 2008, 10:19 PM

Post #8 of 30 (15621 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 (15616 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Mar 30, 2008, 9:42 PM

Post #10 of 30 (15596 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 (15580 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Apr 1, 2008, 10:22 AM

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

mkeith123
Novice

Apr 2, 2008, 1:00 PM

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

KevinR
Veteran

Apr 2, 2008, 1:52 PM

Post #14 of 30 (15566 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 (15517 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Apr 5, 2008, 1:38 PM

Post #16 of 30 (15516 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 (15503 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Apr 6, 2008, 2:06 PM

Post #18 of 30 (15498 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 (15485 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Apr 10, 2008, 11:06 PM

Post #20 of 30 (15480 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:

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 (15475 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Apr 11, 2008, 3:18 PM

Post #22 of 30 (15472 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 (15457 views)
 Post deleted by mkeith123 [In reply to]

KevinR
Veteran

Apr 12, 2008, 1:32 PM

Post #24 of 30 (15452 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 (15438 views)
 Post deleted by mkeith123 [In reply to]

 1 2  View All

 Announcements     PerlGuru Announcements Perl Programming Help     Frequently Asked Questions     Beginner     Intermediate     Advanced     Regular Expressions     mod_perl     DBI     Win32 Programming Help Fun With Perl     Perl Quizzes - Learn Perl the Fun Way     Perl Golf     Perl Poetry Need a Custom or Prewritten Perl Program?     I need a program that...     I Need a Programmer for Freelance Work     Throw Down The Gauntlet General Discussions     General Questions     Feedback     Tutorial/Article Suggestions for The Learning Cent     Internet Security Other Programming Languages     Javascript     PHP

 Search this forum this category all forums for All words Any words Whole Phrase (options) Powered by Gossamer Forum v.1.2.0