473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help with perl and programing !!!!1

6
[quote=gooop]I am new to perl. I am having trouble with this code line I wrote. On thef fourth line I keep getting this message when I go to run this. . Please any advice would help.I am using TextPad, and window xp pro os.This program is suppose to make a modified copy of a text file. In the copy ,every string Fred should be replaced with Larry. I want to have the input filename at the command line. But everytime I go to run this I get the error message below on the 4th line of my code. What is wrong with Usage , am I missing a syntax or something.

Usage:C:\Perl\ch1\ filename at C:\Perl\ch1\ line 4, <> line 1.
Press any key to continue . . .

[#!usr/bin/perl -p
my $in = $ARGV[0];
unless (defined $in) {
die "Usage: $0 filename";
}
print "File: $in\n";
my $out = $in;
$out =~ s/(\.\w+)?$/.out/;
unless (open IN, "<$in") {
die "Can't open '$in': $!";
}
unless (open OUT, ">$out") {
die "Can't write '$out': $!";
}
while (<IN>) {
s/Fred/Larry/gi;
print OUT $_;
}]
Nov 28 '06 #1
1 1282
miller
1,089 Expert 1GB
gooop.

Being completely ignorant is not going to encourage us to help you.
Adding bangs to your subject is not going to encourage us to help you.
Resposting your question in a new thread is not going to encourage us to help you.

GunnerH has already tried to show you an example of how to write a script and run the example. Did you actually try this? You have not acknowledged his efforts in any way.

I will not be providing you any help in this new thread. Ask your questions in your old one, or go figure out your problem on your own.
Nov 28 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: James Hull | last post by:
Hi All: I am new in the Perl world. So far I have installed cygwin and Perl 5.8.0 along with Perl DBI and DBD::Oracle modules. NowI am trying to install Perl Tk on my PC (Windows 2K). I have...
4
by: B McInnes | last post by:
Hello, I am working on creating a perl implementatin of quick sort, I know that there is a perl sort function but I am doing this so that I can later sort a vec based on the information in another...
4
by: Firewalker | last post by:
Hey guys, I am newbie to perl. I am trying to deal with dates ( such trying to find what the date would be after month). Is therea function or date class( I am a java programmer, I couldnt find...
1
by: Marshall Dudley | last post by:
I have an application where I need to encrypt a bit of text, and then I need to be able to decrypt it using a customer's key. I want to make sure that the key to decrypt is NOT on the server...
3
by: John Gibson | last post by:
Hi, all. I read that the "--with-perl" option "Build the PL/Perl server-side language". Does that mean the the switch is necessary to connect to the PostgreSQL database if you are using a perl...
1
by: jrefran | last post by:
Hi everyone! I would like to confirm if there's a need to recompile my Apache if I install Perl. I just used below configuration during my Apache compilation. ./configure...
1
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
1
by: megaman1 | last post by:
I’m trying to connect with perl DBD::Oracle on Windows to Oracle DB (Linux). I compiled the Oracle.dll using the commands “perl Makefile.pl” “nmake” and “nmake install”, but when I try to connect...
0
by: Reedick, Andrew | last post by:
<snip> I have a Perl background and have found the O'Reilly books to be useful. The Learning Python book (or whatever it's called) is good because it covers the paradigm shifts and potential...
9
by: Blubaugh, David A. | last post by:
Sir, You are absolutely correct. I was praying to G_d I did not have to slaughter my project's source code in this manner. However, like life itself, I was given legacy source code (i.e....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
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...

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.