Easy one for all you Perl gurus out there.
I'm opening a text file, reading the contents into an array, doing some processing and spitting out the results to another file. Although I've got this working fine, I had to employ a workaround when opening the file originally.
I wanted to put:
open(INPUT, "d:\pscripts\in put.txt")
or die "Could not open file for reading $!\n";
but when I executed this, it kept dying on me, saying that it couldn't find the file. Eventually, I had to put my input file in the same directory as the script (my workaround) and remove the path from the "open" command above.
It works, but it's bugging me. Why wouldn't it work with the full path?
TIA
4 18533
S'OK - figured it out. The slashes in the Windows path name have to go the other way.
But of course.... ??????
S'OK - figured it out. The slashes in the Windows path name have to go the other way.
But of course.... ??????
because perl on windows follows the unix like paths.
infact in internally trnsalate every path according to unix file system
miller 1,089
Recognized Expert Top Contributor
Your previous code would have worked too, but you needed to escape the backslashes: -
open(INPUT, "d:\\pscripts\\input.txt")
-
or die "Could not open file for reading $!\n";
-
or used single quotes so that the string was not interpolated: -
open(INPUT, 'd:\pscripts\input.txt')
-
or die "Could not open file for reading $!\n";
-
Hi,
I am trying to do a similar thing.
Can you help me sharing your code?
Thanks
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lauren Quantrell |
last post by:
I'd like to use my Access 2K application to write some text in the
file properties of a Windows file. The properties I'm talking about
are the properties you see whn you right click on a Windows file and
then click on Properites, then the Summary tab.
I want to be able to modify the Subject line and the Comments line in
particular.
I'm hoping someone can tell me how to do this.
Thanks,
lq
|
by: muttu2244 |
last post by:
hi all
could anybody please tell me how can i copy a file from windows file
systems like FAT12, FAT16,FAT32 and NTFS to EXT2, and EXT3.
Is their any function in python that we can do the above
Thanks in advance
Yogi
|
by: EP |
last post by:
I'm looking for a method by which to access Windows files metadata and
have not been able to find anything in the standard modules or via
Google - what is the standard approach?
Shamefully I really do not understand Windows file system - e.g. is
properties metadata attached to the file? if I change that metadata
do I change the file's hash? how is the metadata structured? or is
the "properties" metadata simply derived upon access?
...
|
by: mollyf |
last post by:
I just installed SQL Server 2005 on my PC (the developer's edition)
yesterday. I have some scripts written by one of my coworkers to
create some tables and stored procedures in a database that I've
already created on my computer. Whenever I go to open the script file
(whose icon shows that it's a SQL Server Query File and I've got the
file type set to open with SQLWB - SQL Server Management Studio), the
file opens in Notepad instead of...
|
by: Claudio Grondi |
last post by:
Here an example of what I mean
(Python 2.4.2, IDLE 1.1.2, Windows XP SP2, NTFS file system, 80 GByte
large file):
Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
f = file('veryBigFile.dat','r+')
IOError: No such file or directory: 'veryBigFile.dat'
| |
by: albo |
last post by:
hi all !!
i need help in opening an image file (bmp)
and printing it to the screen.
thanks
|
by: W Marsh |
last post by:
Hi. In my application I do something very simple - I open a file, lock
it exclusively, write some data to it and close it.
If I re-open it in the same process (I mean before the script has
ended) to read the file, I find that the data I have written doesn't
exist in there. I can't read it back until I run the script again.
My question follows: WHAT
|
by: blerina |
last post by:
hi,
i have a simple asp code that opens an excel file. it works fine with simple excel files that don't contain formula.
i think the problem is that my excel file contains formulas and calculations.
when opening this file with vb 6.0 code it works fine.
here is a the simple code:
Dim xlObject, xlBook,wks
|
by: Sanjeeva K kanakam |
last post by:
Hi all, I am developing one application. In that i have created on report file which contains tables, titles and tree view list also by using HTML tags. I am opening this file in my application it self as another window.
There is no problem in opening this file if the file is small. If the file is big(here i mean to say if number of tables present in this file)then while opening this file my application is displaying a message "Cannot create...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |