473,748 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tie to change line in file

Being utterly a non Perl IT guy, I have to write a Perl script for a
web site to edit a line in a file. I have looked on Google and found
Tie to be what I needed, but I am really lost in how to change the
line. Can someone please edit the script below for me to show me how
to do this? I have already looked in the documentation and still got
lost...

use CGI qw/:standard/;
use CGI::Cookie;
use Tie::File;
print header;

%cookies = fetch CGI::Cookie;

tie @array, 'Tie::File',
"e:/inetpub/scripts/inventory.txt" or die "Could not Tie in.txt: $!";

for (@array) {
print $_;
last;
}

untie @array; # all finished
Thanks in advance,

Jonathan Weekes
Jul 19 '05 #1
0 1689

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7769
by: pythos | last post by:
How do you change a file's last-modified date and timestamp in Python?
4
6549
by: wil | last post by:
Dear All, In the linux platform, is there anyway I can in a C program change the file create date? Thanks, wil.
0
921
by: Screaming Eagles 101 | last post by:
I'dd like to change line(x) in a richtextbox, wordwrap is true, multiline is true. This ain't possible sayin' myTBX.Lines(5) = "blablabla" it seems... Why not ? I have a workaround by saying stringaray() = myTBX.Lines and then some concatenation code by using myTBX.text = "" for i = 0 to .... myTBX.text &= stringaray(i) & "blabla"
6
4901
by: VishalK | last post by:
Friends.. I have a HTML file. Using HTML Code, I want to change its file extension from .html to .mht. eg : TestFile.html to be converted to TestFile.mht Anybody has any idea about this ? Please let me know. Thanks in advance. Regards, Vishal
0
1120
by: =?Utf-8?B?TW9uaWNh?= | last post by:
Hi, How can I change default file extensions in FileUpload Control (Using ASP.NET, Web site design)? Thank you in advance. Monica.
3
7342
by: terrychangsharp | last post by:
I think this must be easy but, alas, I can't find it! Is there any function I can use to change a file's date/time?
3
13932
by: xke | last post by:
Other than copying the file under a different name and delete the initial file, is there any other way to change a file name in vb.net ? Thanks, xk
1
1664
by: PSiegmann | last post by:
Hello group, if I open with streamreader a file to read in that way: StreamReader sr = new StreamReader(c:\\test.txt, System.Text.Encoding.GetEncoding(10000)); Is it possible that it can change the file in any way? (Change the encoding of the actual file as example)
3
2409
by: phpuser123 | last post by:
I have a label and when setting the text I want to change line . For instance String str="first line \n Secondline "; JLabel label.setText(str); I tried the above code but it does not work..How do I change line in a string ?
0
8994
marktang
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...
0
8831
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,...
0
9555
Oralloy
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...
1
9329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9250
tracyyun
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...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
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...
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.