[22648] in Perl-Users-Digest
Perl-Users Digest, Issue: 4869 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 21 09:10:46 2003
Date: Mon, 21 Apr 2003 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 21 Apr 2003 Volume: 10 Number: 4869
Today's topics:
Accesing machines of a network <kasp@epatra.com>
Re: Accesing machines of a network <kasp@epatra.com>
Re: Accesing machines of a network <kasp@epatra.com>
Re: Beginners question - directions please... <goedicke@goedsole.com>
Re: Copying files efficiently <kasp@epatra.com>
CreateObject equivalent in Perl <kasp@epatra.com>
Re: design considerations for using DB_File tie hashes (Sara)
Re: Matching multiple lines (Tad McClellan)
Re: Matching multiple lines <ccsc3618@bigpond.net.au>
Re: Matching multiple lines (Sara)
need help with the pod2html <abhingarde@direcway.com>
Re: Net::Ftp and the use of the FTP user command <kasp@epatra.com>
Re: Newbie Help searching for a ^ character ... <ccsc3618@bigpond.net.au>
Re: Newbie Help searching for a ^ character ... <kasp@epatra.com>
newbie question regarding s/<old string>/<new string>/g <dlaw001@yahoonospam.co.uk>
Re: newbie question regarding s/<old string>/<new strin <noreply@gunnar.cc>
Re: newbie question regarding s/<old string>/<new strin <kasp@epatra.com>
Re: newbie question regarding s/<old string>/<new strin <ccsc3618@bigpond.net.au>
perl-module for HTTP POST <rikard_bo@yahoo.no>
Re: perl-module for HTTP POST <ccsc3618@bigpond.net.au>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 21 Apr 2003 11:37:02 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Accesing machines of a network
Message-Id: <b801qg$sp7$1@newsreader.mailgate.org>
Hello,
As per my word, I am here today to show you guys my script. This is just
phase one.
And I need your views and reviews. What can I do to make it better and
_how_?
I made this for Windows. Hence you will notice the slash difference.
Also, I have stored the absolute path names of files in lower case. I plan
to get a web interface (CGI) along and search on this data.
Script is below:
#Function prototype
sub wanted();
sub dumpToFile();
sub pingMachine($);
sub getBaseFolders(@);
sub getFilesRecursively();
sub getMachineNames(@);
### main program
@allFileName = []; #global array
my ($mcName, $folderName, $file);
my (@contents, @baseFolders);
my @machineName = [];
my @searchWorkGroups = ('myWorkGroup1, myWorkGroup2');
#get list of machine names lying in this Work Group
@machineName = &getMachineNames(@searchWorkGroups);
#iterate over each machine name
foreach $mcName (@machineName){
print "Scanning m/c ... $mcName\n";
#Can machine be pinged?
if( ! pingMachine($mcName)){
warn "$mcName can not be pinged.\n" ;
next; #skip processing for this machine
}
@baseFolders = &getBaseFolders($mcName);
#Index range is 0 - $#baseFolders
if( $#baseFolders > 0){
#recursively search down each base folder
foreach $folderName (@baseFolders){
print ("+--------------- $folderName \n");
&getFilesRecursively($folderName);
}
}
&dumpToFile();
}
####################################################
#Arg: Nothing
# Appends contents of @allFileNames to a file
#Returns: Nothing
####################################################
sub dumpToFile(){
my $file;
#save to a file
open(OUT, ">>allFileNames.txt") or
die "Failed to open allFileNames.txt. $!";
#Convert to lower case. This will help in searching later.
#Replace / in @allFileNames with \
while( $file = pop(@allFileNames) ){
$file = lc($file);
$file =~ s/\//\\/g;
print OUT "$file\n";
}
close(OUT);
}
####################################################
#Arg: 1 - //MachineName/sharedFolder whose files are
# to be retrieved recusively
#Returns: 1 - GLOBAL Array - @allFileNames -
# Containing the list of files names(/d/f)
####################################################
sub getFilesRecursively() {
use File::Find;
find(\&wanted, @_);
#but path has // instead of \
}
sub wanted(){
#absoulte path is in $File::Find::name
#but it has // instead of \ in path
push (@allFileNames, $File::Find::name);
###NOTE :: @allFileNames is a global array
}
####################################################
#Arg: 1 - Machine Name whose shared folders are
# to be retrieved.
#Returns: 1 - Array - Containing base folder names
####################################################
sub getBaseFolders(@){
my $machineName = shift;
my @baseFolderNames;
use Win32::NetResource qw(:DEFAULT GetSharedResources GetError);
my $resources = [];
unless(GetSharedResources($resources, RESOURCETYPE_DISK,
{ RemoteName => "\\\\".$machineName })) {
my $err;
GetError($err);
warn Win32::FormatMessage($err);
}
foreach my $href (@$resources) {
next if ($$href{DisplayType} != RESOURCEDISPLAYTYPE_SHARE);
push(@baseFolderNames, $href->{RemoteName});
}
return @baseFolderNames;
}
####################################################
#Arg: 1 - Machine Name or IP Address
#Returns: 1 - Scalar - True or False indicating
# whether the machine is alive or not.
####################################################
sub pingMachine($){
use Net::Ping;
my $host = shift;
my $p = Net::Ping->new();
my $returnVal = $p->ping($host);
$p->close();
return $returnVal;
}
####################################################
#Arg: 1 - Machine Name or IP Address
#Returns: 1 - Scalar - True or False indicating
# whether the machine is alive or not.
####################################################
sub getMachineNames(@)
{
my (@searchWorkGroups) = (@_);
my %machineNames = [];
my $cmdNetView = 'net view /DOMAIN:';
my $tmpFile = 'tmp.txt';
#Net view /DOMAIN:DomainName > tmp.txt will get the machine
#names under domain = DomainName
#tmp.txt has machine names in format "\\MachineName"
foreach my $workGroup (@searchWorkGroups){
system($cmdNetView.$workGroup." > $tmpFile");
#scan tmp.txt and load machine names into a hash (avoid duplicacy)
open(IN, $tmpFile) or
die "Failed to open $tmpFile. $!";
while(<IN>){
chomp;
if(m/^\\\\(\w+)/){
#add the machine name ($_) to the hash
#eliminates duplicate machine names if any
$machineNames{$1}="";
}
}
close(IN);
unlink ($tmpFile); #delete this tmp file
}
return sort(keys(%machineNames));
}
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 13:11:33 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Accesing machines of a network
Message-Id: <b807ve$32m$1@newsreader.mailgate.org>
Hello,
As per my word, I am here today to show you guys my script. This is just
phase one.
And I need your views and reviews. What can I do to make it better and
_how_?
I made this for Windows. Hence you will notice the slash difference.
Also, I have stored the absolute path names of files in lower case. I plan
to get a web interface (CGI) along and search on this data.
Script is below:
#Function prototype
sub wanted();
sub dumpToFile();
sub pingMachine($);
sub getBaseFolders(@);
sub getFilesRecursively();
sub getMachineNames(@);
### main program
@allFileName = []; #global array
my ($mcName, $folderName, $file);
my (@contents, @baseFolders);
my @machineName = [];
my @searchWorkGroups = ('myWorkGroup1, myWorkGroup2');
#get list of machine names lying in this Work Group
@machineName = &getMachineNames(@searchWorkGroups);
#iterate over each machine name
foreach $mcName (@machineName){
print "Scanning m/c ... $mcName\n";
#Can machine be pinged?
if( ! pingMachine($mcName)){
warn "$mcName can not be pinged.\n" ;
next; #skip processing for this machine
}
@baseFolders = &getBaseFolders($mcName);
#Index range is 0 - $#baseFolders
if( $#baseFolders > 0){
#recursively search down each base folder
foreach $folderName (@baseFolders){
print ("+--------------- $folderName \n");
&getFilesRecursively($folderName);
}
}
&dumpToFile();
}
####################################################
#Arg: Nothing
# Appends contents of @allFileNames to a file
#Returns: Nothing
####################################################
sub dumpToFile(){
my $file;
#save to a file
open(OUT, ">>allFileNames.txt") or
die "Failed to open allFileNames.txt. $!";
#Convert to lower case. This will help in searching later.
#Replace / in @allFileNames with \
while( $file = pop(@allFileNames) ){
$file = lc($file);
$file =~ s/\//\\/g;
print OUT "$file\n";
}
close(OUT);
}
####################################################
#Arg: 1 - //MachineName/sharedFolder whose files are
# to be retrieved recusively
#Returns: 1 - GLOBAL Array - @allFileNames -
# Containing the list of files names(/d/f)
####################################################
sub getFilesRecursively() {
use File::Find;
find(\&wanted, @_);
#but path has // instead of \
}
sub wanted(){
#absoulte path is in $File::Find::name
#but it has // instead of \ in path
push (@allFileNames, $File::Find::name);
###NOTE :: @allFileNames is a global array
}
####################################################
#Arg: 1 - Machine Name whose shared folders are
# to be retrieved.
#Returns: 1 - Array - Containing base folder names
####################################################
sub getBaseFolders(@){
my $machineName = shift;
my @baseFolderNames;
use Win32::NetResource qw(:DEFAULT GetSharedResources GetError);
my $resources = [];
unless(GetSharedResources($resources, RESOURCETYPE_DISK,
{ RemoteName => "\\\\".$machineName })) {
my $err;
GetError($err);
warn Win32::FormatMessage($err);
}
foreach my $href (@$resources) {
next if ($$href{DisplayType} != RESOURCEDISPLAYTYPE_SHARE);
push(@baseFolderNames, $href->{RemoteName});
}
return @baseFolderNames;
}
####################################################
#Arg: 1 - Machine Name or IP Address
#Returns: 1 - Scalar - True or False indicating
# whether the machine is alive or not.
####################################################
sub pingMachine($){
use Net::Ping;
my $host = shift;
my $p = Net::Ping->new();
my $returnVal = $p->ping($host);
$p->close();
return $returnVal;
}
####################################################
#Arg: 1 - Machine Name or IP Address
#Returns: 1 - Scalar - True or False indicating
# whether the machine is alive or not.
####################################################
sub getMachineNames(@)
{
my (@searchWorkGroups) = (@_);
my %machineNames = [];
my $cmdNetView = 'net view /DOMAIN:';
my $tmpFile = 'tmp.txt';
#Net view /DOMAIN:DomainName > tmp.txt will get the machine
#names under domain = DomainName
#tmp.txt has machine names in format "\\MachineName"
foreach my $workGroup (@searchWorkGroups){
system($cmdNetView.$workGroup." > $tmpFile");
#scan tmp.txt and load machine names into a hash (avoid duplicacy)
open(IN, $tmpFile) or
die "Failed to open $tmpFile. $!";
while(<IN>){
chomp;
if(m/^\\\\(\w+)/){
#add the machine name ($_) to the hash
#eliminates duplicate machine names if any
$machineNames{$1}="";
}
}
close(IN);
unlink ($tmpFile); #delete this tmp file
}
return sort(keys(%machineNames));
}
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 13:13:31 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Accesing machines of a network
Message-Id: <b807vf$32m$2@newsreader.mailgate.org>
I dont know why the script came here...it wasn't meant to be.
Anyway, I have posted it again under the proper thread.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 11:48:46 GMT
From: William Goedicke <goedicke@goedsole.com>
Subject: Re: Beginners question - directions please...
Message-Id: <m33ckcjckn.fsf@mail.goedsole.com>
Dear Tony -
"Tony" <no_spam@no.spam.org.invalid> writes:
> My biggest perolem is that I do not know how to get from the
> given file format to an array with a suitable format that can be
> run,
I think that the crux of your problem is that the file format you're
using is awkward. You should provide information that describes the
data so you don't have to write code to "recognize" data types.
Therefore change:
MON # The day of the week to take action...
0 # The output device to use...0 in this case
02:00 # The time to process the listed files
12:00 # The next time to process the listed files
to:
DAY:MON # The day of the week to take action...
DEVICE:0 # The output device to use...0 in this case
PTIME:02:00 # The time to process the listed files
NTIME:12:00 # The next time to process the listed files
Once you can easily recognize lines you can use a regular expression
with the match operator to assign substrings to variables:
if ( m/^DAY/ ) {
( $label, $day ) =~ /(\w*):(\w*)/;
}
Or to an array:
@input =~ /(\w*):(\w*)/;
Even better is to format the config as XML. XML's whole shtick is
being easy to read (and write) with programs. perl leverages this
very well with the XML::Simple CPAN module. All you have to say is
something like:
use XML::Simple;
my $config_href = XMLin('scheduled_dump.xml');
You'll find installing XML::Simple a little challenging it has
extensive pre-requisites, but it's well worth the effort.
You'll also need to create the XML files. It's just text so however
you were going to create the config file will work. Personally I'd
create a data structure that contains the information that belongs in
the config file. Then use XMLout to convert the data structure into
XML. Then I'd use the CGI module an write up a little web front-end
to eliminate typos in the config files.
Yours - Billy
============================================================
William Goedicke goedicke@goedsole.com
http://www.goedsole.com:8080
============================================================
Lest we forget:
Finesse not force.
- William Goedicke
------------------------------
Date: Mon, 21 Apr 2003 13:22:05 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Copying files efficiently
Message-Id: <b807vj$32m$5@newsreader.mailgate.org>
Although not related to perl, you should ensure that backup disk is
defragmented properly.
A disk with many fragmentations will result in slow I/O.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 15:42:53 +0530
From: "Kasp" <kasp@epatra.com>
Subject: CreateObject equivalent in Perl
Message-Id: <b80g7d$dol$1@newsreader.mailgate.org>
What would be the equivalent of CreateObject in Perl?
Eg. from some VB code:
Dim accessIbj = CreateObject("Access.Application.8")
Thanks.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: 21 Apr 2003 05:24:02 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: design considerations for using DB_File tie hashes ???
Message-Id: <776e0325.0304210424.207e824d@posting.google.com>
botfood@yahoo.com (dan baker) wrote in message news:<13685ef8.0304191036.4c1fefd4@posting.google.com>...
> hi folks... I'm in the preliminary stages of designing a membership
> management system that will be driven with a html based interface and
> wanted to get some high-level pros and cons and does and donts with
> regard to methods for storing the data.
>
.
.
.
I see Norbert already adeptly answered most of your questions. A
couple of comments on what you're doing:
(1) there are many implementations, SDBM, GDBM, etc. Choose wisely.
Some are impractical in some applications.
(2) consider using a real DB (i.e. mysql) if you plan on managing more
than say 5000 records, or if you think you may need to do ad hoc
queries. The latter is a VERY NICE capability that can save you hours
of coding later, since with the *DBM you have to basically write a
program everytime you have a custom DB mod.
As far as the size- you may discover that the *DBM's get PAINFULLY
slow as they grow. I had a DBM of about 25000 recs, and it was
virtually unusable. So in the end I ended up going to mysql anyhow!
**************************
Not trying to discourage you- just giving you a few tips from someone
who's been down this road a few times!
Cheers,
Gx
------------------------------
Date: Mon, 21 Apr 2003 01:36:15 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Matching multiple lines
Message-Id: <slrnba74av.m4q.tadmc@magna.augustmail.com>
rjh <ccsc3618@bigpond.net.au> wrote:
> Im trying to search the file for the ---------- delimiter and then read the
> data into an array, then search the
> array for a match and then print out the array.
Look up the $/ variable in perlvar.pod.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 21 Apr 2003 06:22:13 GMT
From: "rjh" <ccsc3618@bigpond.net.au>
Subject: Re: Matching multiple lines
Message-Id: <p6Moa.4294$8K2.33656@news-server.bigpond.net.au>
thanks very much for the pointer. that works like a charm.
its good to receive help from someone that knows their stuff (cough) Perl !
cheers
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnba74av.m4q.tadmc@magna.augustmail.com...
> rjh <ccsc3618@bigpond.net.au> wrote:
>
> > Im trying to search the file for the ---------- delimiter and then read
the
> > data into an array, then search the
> > array for a match and then print out the array.
>
>
> Look up the $/ variable in perlvar.pod.
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: 21 Apr 2003 05:17:38 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: Matching multiple lines
Message-Id: <776e0325.0304210417.134842bb@posting.google.com>
"rjh" <ccsc3618@bigpond.net.au> wrote in message news:<qcIoa.3876$8K2.31788@news-server.bigpond.net.au>...
.
.
> Im trying to search the file for the ---------- delimiter and then read the
> data into an array, then search the
> array for a match and then print out the array. My current solution doesnt
> work very well.
> Has anyone attempted anything similar to this ??
>
.
.
Probabilistically, I'd say it's almost a certainty someone has tried
this. If I we're in your position I'd want to study up on the "m" and
"s" regex options, like
print "yay its here!\n" if $paragraph =~ /mystring/ms;
You can mess around with EOL terminators too but this is probably more
practical.
Cheers,
Gx
------------------------------
Date: Mon, 21 Apr 2003 00:10:37 -0400
From: "Atul Bhingarde" <abhingarde@direcway.com>
Subject: need help with the pod2html
Message-Id: <MbKoa.62503$NV.1526690@news.direcpc.com>
Hi,
I am working on documenting my own perl scripts.
I have tried the pod2html in the past and I am happy with the tasks
pod2html performed.
The ecripts I have developed is bacsically 5 modules and the document I
want to create need to be interwoven and would like to keep the document
location raltive to the origibal
Another thing is about the href option in the pod
Can some one guide me hoe I can do that
Thanks
Atul
------------------------------
Date: Mon, 21 Apr 2003 13:18:13 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Net::Ftp and the use of the FTP user command
Message-Id: <b807vi$32m$4@newsreader.mailgate.org>
What's the problem and what's the question?
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 05:37:02 GMT
From: "rjh" <ccsc3618@bigpond.net.au>
Subject: Re: Newbie Help searching for a ^ character ...
Message-Id: <2sLoa.4249$8K2.34284@news-server.bigpond.net.au>
hi,
not sure what your data looks like but if we are dealing with single word
lines,
try this loop
#!/usr/bin/perl
while (<>){
if(m/\^(\w)/){
print "blah\n"; IE Skip this line
}
}
this will match a word that starts with ^
"Newbie" <dlaw001@yahoonospam.co.uk> wrote in message
news:9zHoa.60$Fd1.253149@newsfep2-gui.server.ntli.net...
> Hi
>
> Its 2 am on a sunday mourning and I'm not thinking as straight
> as I should be .and I can't seem to find my "perl book" ...
> What I'm trying to is search a string to see if contains a '^' if so skip
> that line and continue reading in the remainder of the lines
>
> ie if the $Line is ^FT2000 it skips while FT2000 is ok
>
> if( !( $Line = ?????????? ) ) {
> /* Line does not contain any ^ characters...*/
> .
> .
> }
>
> Any help or pointers would be greatly appreciated...
>
> Thanks
> David
> ps remove the nospam from my email address...
>
>
------------------------------
Date: Mon, 21 Apr 2003 13:30:51 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Newbie Help searching for a ^ character ...
Message-Id: <b808hb$3mo$1@newsreader.mailgate.org>
I tried this:
while(<STDIN>){
if($_ =~ /\^/ )
{
print "Match\n"; #Has ^ in it
}
}
So, you should check something like this
if( ! ( $Line =~ /\^/ ) ) {
/* Line does not contain any ^ characters...*/
.
}
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 07:27:04 +0100
From: "Newbie" <dlaw001@yahoonospam.co.uk>
Subject: newbie question regarding s/<old string>/<new string>/g
Message-Id: <y8Moa.11$P77.10437@newsfep2-gui.server.ntli.net>
Hi
I've been trying to get the following working...
$Lines =~s/\N/A/0/g;
Lines will contain a string, it may or may not have the abbreviation N/A
in it.
What I need to do is search the string $Lines for the abbrev. N/A
and replace it with 0. Is this possible ?
I have tried the following
$Lines =~s/\"N/A"/0/g;
I have also tried a few variations but seems to be going around in circles
any pointers or help would be greatly appreciated.
Thanks
David.
ps remove nospam from email address...
------------------------------
Date: Mon, 21 Apr 2003 09:29:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: newbie question regarding s/<old string>/<new string>/g
Message-Id: <b806l6$50149$1@ID-184292.news.dfncis.de>
Newbie wrote:
> I've been trying to get the following working...
>
> $Lines =~s/\N/A/0/g;
>
> Lines will contain a string, it may or may not have the abbreviation N/A
> in it.
> What I need to do is search the string $Lines for the abbrev. N/A
> and replace it with 0. Is this possible ?
>
> I have tried the following
Have you possibly tried to _read_ anything about regular expressions
in Perl, like http://www.perldoc.com/perl5.8.0/pod/perlre.html ?
The N character must not be escaped, while the '/' must be escaped as
long as you are using slashes as delimiters.
This should do what you want:
$Lines =~ s/N\/A/0/g;
And so should this:
$Lines =~ s!N/A!0!g;
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 21 Apr 2003 13:23:49 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: newbie question regarding s/<old string>/<new string>/g
Message-Id: <b8082i$33j$1@newsreader.mailgate.org>
> $Lines =~s/\N/A/0/g;
> Lines will contain a string, it may or may not have the abbreviation N/A
in it.
> What I need to do is search the string $Lines for the abbrev. N/A
> and replace it with 0. Is this possible ?
Try this (untested)
$Lines =~ s/N\/A/0/g;
In your reg.exp, you are escaping N (\N) ! Why?
Also, you need to escape / as \/.
It's best to put a piece of code that we can try out here...
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 08:31:03 GMT
From: "rjh" <ccsc3618@bigpond.net.au>
Subject: Re: newbie question regarding s/<old string>/<new string>/g
Message-Id: <b%Noa.4443$8K2.36575@news-server.bigpond.net.au>
try saving this to file, then run it via $perl filename.pl
basically you can change the / / separators to | |....
#!/usr/bin/perl
while (<>){
s|N/A|0|;
print $_ . "\n";
}
"Newbie" <dlaw001@yahoonospam.co.uk> wrote in message
news:y8Moa.11$P77.10437@newsfep2-gui.server.ntli.net...
> Hi
>
> I've been trying to get the following working...
>
> $Lines =~s/\N/A/0/g;
>
> Lines will contain a string, it may or may not have the abbreviation N/A
> in it.
> What I need to do is search the string $Lines for the abbrev. N/A
> and replace it with 0. Is this possible ?
>
> I have tried the following
>
> $Lines =~s/\"N/A"/0/g;
>
> I have also tried a few variations but seems to be going around in circles
> any pointers or help would be greatly appreciated.
>
> Thanks
> David.
> ps remove nospam from email address...
>
>
------------------------------
Date: Mon, 21 Apr 2003 12:45:09 +0200
From: Rikard Bø <rikard_bo@yahoo.no>
Subject: perl-module for HTTP POST
Message-Id: <phi7avgfptt8vin2i551q7949f6kfo9mov@4ax.com>
Hi!
I'm loooking for a perl module that can handle HTTP POST !
I want to send some text, maybe an entire text-file, as a FORM
element!
Does anyone what perl module to use, and where to find it?
And maybe a code example aswell?
--
Rikard Bø
------------------------------
Date: Mon, 21 Apr 2003 11:56:21 GMT
From: "rjh" <ccsc3618@bigpond.net.au>
Subject: Re: perl-module for HTTP POST
Message-Id: <F%Qoa.4779$8K2.38976@news-server.bigpond.net.au>
hi,
use CGI;
http://stein.cshl.org/~lstein/
is a good place to start.
"Rikard Bø" <rikard_bo@yahoo.no> wrote in message
news:phi7avgfptt8vin2i551q7949f6kfo9mov@4ax.com...
> Hi!
>
> I'm loooking for a perl module that can handle HTTP POST !
> I want to send some text, maybe an entire text-file, as a FORM
> element!
>
> Does anyone what perl module to use, and where to find it?
> And maybe a code example aswell?
>
> --
> Rikard Bø
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 4869
***************************************