in reply to Re: Intercharacter spacing
in thread Intercharacter spacing
Here's the text file:#!/usr/bin/perl # nlexample.plx # The script opens a text file, reads it, prints a number and # then each line within the file. use warnings; use strict; use diagnostics; open FILE, 'C:\Perl\Perl practice\test.txt' or die $!; my $lineno = 1; while(<FILE>) { print $lineno++; print ": $_"; }
One day you're going to have to face A deep dark truthfull terror, And it's gonna tell you things that I still Love you too much to say. ####### Elvis Costello, Spike, 1988 #######And the expected response:
1:One day you're going to have to face 2: A deep dark truthfull terror, 3:And it's gonna tell you things that I still 4: Love you too much to say. 5:####### Elvis Costello, Spike, 1988 #######
Problem:
1. Why is this exception occurring? Perl seems to be looking for the text file at the same location every time: how do I change this? Why is Perl looking for the test.txt file at this location? Must be a default setting.I using DzSoft Perl Editor to write my dode, and running from by the DOS promted provided by the IDE.
Very odd place for Windows to look for the files, as there”¦s no such file as ”„dir11.tmp”¦ when I look through the directory structure in Windows Explorer. Grrr. ¼ Windows seems to be looking for a temp file containing the perl source: what the hell is going on?!Uncaught exception from user code: No such file or directory at C:\DOCUMENTS AND SETTINGS\RICHARD LAMB \L +OCAL SETTINGS\Temp\dir11.tmp\nlexample.plx line 8
Solution: Locating the test.txt file in local settings?
edited: Thu Jul 24 00:37:03 2003 by jeffa - code tags formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Intercharacter spacing
by graff (Chancellor) on Jul 24, 2003 at 04:41 UTC | |
by Tricky (Sexton) on Aug 11, 2003 at 13:37 UTC | |
by graff (Chancellor) on Aug 12, 2003 at 01:31 UTC | |
by Tricky (Sexton) on Aug 16, 2003 at 15:31 UTC | |
by graff (Chancellor) on Aug 16, 2003 at 19:34 UTC | |
by Tricky (Sexton) on Aug 07, 2003 at 13:48 UTC |