[18969] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1164 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 20 11:05:37 2001

Date: Wed, 20 Jun 2001 08:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <993049511-v10-i1164@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 20 Jun 2001     Volume: 10 Number: 1164

Today's topics:
        adding newline in binary files <bard.selbekk@edbteamco.NO_SPAMcom>
    Re: adding newline in binary files <pne-news-20010620@newton.digitalspace.net>
    Re: adding newline in binary files <bard.selbekk@edbteamco.NO_SPAMcom>
    Re: adding newline in binary files <pne-news-20010620@newton.digitalspace.net>
    Re: clean install and still perl won't work <somewhere@in.paradise.net>
    Re: DBM in a CGI (please help) <mjcarman@home.com>
        double key for hashtable <torsten.drees@detecon.com>
    Re: double key for hashtable (Rafael Garcia-Suarez)
        Executing files from a directory <gortona@cs.man.ac.uk>
    Re: Executing files from a directory <gtoomey@usa.net>
    Re: Fetching CGI data as a hash (was DBM in a CGI) <jason@uklinux.net>
    Re: Fetching CGI data as a hash (was DBM in a CGI) (Rafael Garcia-Suarez)
    Re: Fetching CGI data as a hash (was DBM in a CGI) <jason@uklinux.net>
    Re: Get all the possibilities <ren@tivoli.com>
        How i Install module in NT platform (Eli)
        How i Install Perl module in NT platform (Eli)
    Re: How i Install Perl module in NT platform <pne-news-20010620@newton.digitalspace.net>
        How i Send E-mail (Eli)
    Re: How i Send E-mail <pne-news-20010620@newton.digitalspace.net>
    Re: Looking for descriptions of IngPerl Functions and V <jboes@nexcerpt.com>
    Re: OLE automation w/ MS Word <Jeremy.Gurney@protherics.com>
        ord() and ...? <daniel.hendrickx@alcatel.be>
    Re: ord() and ...? <carlos@plant.student.utwente.nl>
    Re: ord() and ...? <bill.kemp@wire2.com>
    Re: ord() and ...? (Bernard El-Hagin)
    Re: ord() and ...? <daniel.hendrickx@alcatel.be>
    Re: ord() and ...? <bart.lateur@skynet.be>
    Re: parsing log file (Mike Eggleston)
    Re: premature end of script or malformed header <somewhere@in.paradise.net>
        Reference-problem <sserena@freesurf.ch>
    Re: Reference-problem (Rafael Garcia-Suarez)
    Re: Regexps, using variables to get $1, $2, etc. <carlos@plant.student.utwente.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 20 Jun 2001 11:08:41 GMT
From: Bard Selbekk <bard.selbekk@edbteamco.NO_SPAMcom>
Subject: adding newline in binary files
Message-Id: <Xns90C6859458699bardselbekkedbteamco@134.47.108.15>

Hi, comp.lang.perl.misc!

I have a rather large (40MB) file, and a rather odd request. I want to 
insert a newline (\n) after every 448 character in a binary file. Tried to 
do the job with this:
    open(F_FILE,"$input_file");
    while(<F_FILE>) {
        s/.{448}/$&\n/g;
        print "$_";
    }
    close F_FILE; 
which worked on plain text files, but the special characters are probably 
jamming the processing. Another suggestion was this:
{
    local $/ = \448;
    open F_FILE, $input_file or die "Could not open $input_file: $!";
    while(<F_FILE>) {
        print $_, "\n";
    } 
    close F_FILE;
}

But that did not work either. It seems like the default 
INPUT_RECORD_SEPARATOR is set to something other than the default, but I 
don't know what. The 
    	print $_, "\n";
seems to print the whole file, and then a newline.

Does anyone have a suggestion here?

Thanks.

-Bard


------------------------------

Date: Wed, 20 Jun 2001 13:43:55 +0200
From: Philip Newton <pne-news-20010620@newton.digitalspace.net>
Subject: Re: adding newline in binary files
Message-Id: <6331jtsuj4o2khvlfeaccr0tkueir3u641@4ax.com>

On 20 Jun 2001 11:08:41 GMT, Bard Selbekk
<bard.selbekk@edbteamco.NO_SPAMcom> wrote:

> Does anyone have a suggestion here?

Use read() in a loop? That lets you specify how many characters you
want.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: 20 Jun 2001 13:01:43 GMT
From: Bard Selbekk <bard.selbekk@edbteamco.NO_SPAMcom>
Subject: Re: adding newline in binary files
Message-Id: <Xns90C698BD95301bardselbekkedbteamco@134.47.108.15>

Philip Newton <pne-news-20010620@newton.digitalspace.net> wrote in 
news:6331jtsuj4o2khvlfeaccr0tkueir3u641@4ax.com:
> 
> Use read() in a loop? That lets you specify how many characters you
> want.
> 

Thank you very much, sir. That really did the trick!

  $input_file = "BCD";
  open(UTFIL, ">UTFIL.txt");
  open(F_FILE, $input_file);
  while (read F_FILE, $buf, 448) { 
      print UTFIL $buf . "\n";
  }
  close F_FILE;


-Bard


------------------------------

Date: Wed, 20 Jun 2001 16:07:03 +0200
From: Philip Newton <pne-news-20010620@newton.digitalspace.net>
Subject: Re: adding newline in binary files
Message-Id: <meb1jt4b6hkk3rq4htaidilbumd0vkrs0m@4ax.com>

On 20 Jun 2001 13:01:43 GMT, Bard Selbekk
<bard.selbekk@edbteamco.NO_SPAMcom> wrote:

>   $input_file = "BCD";
>   open(UTFIL, ">UTFIL.txt");
>   open(F_FILE, $input_file);
>   while (read F_FILE, $buf, 448) { 
>       print UTFIL $buf . "\n";
>   }
>   close F_FILE;

I hope the real version checks the return value of the opens and the
close :)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: Wed, 20 Jun 2001 21:48:35 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: clean install and still perl won't work
Message-Id: <b50Y6.20$yC2.916568@news.interact.net.au>


"Frank" <tiberianqs@yahoo.com> wrote in message
news:ceaf9a51.0106200123.41ae8077@posting.google.com...
> I am using windows 2000 (clean no other server is installated)
> I installed the sambar web server (www.sambar.com)
> then installed ActivePerl-5.6.1.626-MSWin32
>
> When i put a HTML doc into the local host. it works
> But when i Put a Perl doc  .pl  on the cgi-bin directory
> and then try to run it from my Internet Browser. It won't run the .pl
program.
>
> what is the problem ?

You haven't told us what the error is.  Anyway, this is a webserver issue,
not a Perl issue.




------------------------------

Date: Mon, 18 Jun 2001 16:07:14 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: DBM in a CGI (please help)
Message-Id: <3B2E6D82.11297C25@home.com>

Amittai Aviram wrote:
> 
> I am just getting started in both Perl and Unix.  A project I am
> building takes data from a form and stores it in a series of DBM
> database files. [...]
> This _did_ work when I ran the script from the command line, but
> when I made the necessary small changes and tried running the
> script as a true CGI script from my browser, it did not create
> the DBM database file. [...]
> I do get the HTML text on my screen (colors, etc.), but no DBM
> is created.

Did you get a message from the die() when you tried to run it via CGI?
Error messages go to STDERR, so it would probably show up in your
server's logfile. You should probably be using CGI.pm. It's hardly
needed for so simple of an example, but it is good for larger scripts,
and lets you send fatal errors to the browser. (Bad for production
scripts, good for debugging.)

use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';

Since your script did work from the command line, I'd wager that the
problem is permissions. Not the permissions on the script itself, but
the permissions with which it runs.

Running from the command line, your script executes as you, and you can
create files in your home directory. For security reasons, the webserver
probably runs as 'nobody' -- a restricted account which has very limited
permissions. It can't create files in your directory.

-mjc


------------------------------

Date: Wed, 20 Jun 2001 16:05:53 +0200
From: "Torsten Drees" <torsten.drees@detecon.com>
Subject: double key for hashtable
Message-Id: <34E1B02BAC87D3119F2700A0C970385E09E68523@news.detecon.de>

Hi people,

i have an interesting problem. i wrote two records in a hash table with the
same key. Is it possible to get back, both records.
If not, is it possible to define a subkey?


please help me


thank you

Torsten




------------------------------

Date: 20 Jun 2001 14:25:54 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: double key for hashtable
Message-Id: <slrn9j1cl4.15c.rgarciasuarez@rafael.kazibao.net>

Torsten Drees wrote in comp.lang.perl.misc:
} Hi people,
} 
} i have an interesting problem. i wrote two records in a hash table with the
} same key. Is it possible to get back, both records.

No, it isn't.

} If not, is it possible to define a subkey?

You can store a reference to an array into a hash :

  $hash{'key'} = [ 'value_1', 'value_2' ];

See the perlreftut and perlref manpages to know how to use references in
Perl to construct complex data structures.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


------------------------------

Date: Wed, 20 Jun 2001 11:00:45 +0100
From: Andrew Paul Gorton <gortona@cs.man.ac.uk>
Subject: Executing files from a directory
Message-Id: <3B30744D.AB031971@cs.man.ac.uk>

Hi

I have a client/server architecture and on the server side I need it to
execute a set of perl scripts from a directory, then return the output
to the server.  Any suggestions of how to do this will be much
appreciated.

cheers :-)


------------------------------

Date: Wed, 20 Jun 2001 21:15:47 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Executing files from a directory
Message-Id: <xl%X6.87199$hV3.137365@newsfeeds.bigpond.com>


"Andrew Paul Gorton" <gortona@cs.man.ac.uk> wrote in message
news:3B30744D.AB031971@cs.man.ac.uk...
> Hi
>
> I have a client/server architecture and on the server side I need it to
> execute a set of perl scripts from a directory, then return the output
> to the server.  Any suggestions of how to do this will be much
> appreciated.
>
> cheers :-)

You say this is a "client/server" architecture. But you then say you are
executing scripts on a server with the output going to a server?

Executing processes on a remote machine can be done with "rsh" on
Berkeley-based Unix.

gtoomey




------------------------------

Date: Wed, 20 Jun 2001 13:25:26 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: Fetching CGI data as a hash (was DBM in a CGI)
Message-Id: <Pine.LNX.4.30.0106201324510.9705-100000@s1.uklinux.net>

On Tue, 19 Jun 2001, gnari wrote:

> >> %fields = $query->Vars;
> >
> >This is not supported. You need to do something along the lines of:
>
> upgrade your CGI.pm.

In an ideal world however where a script is hosted on someone else's box
that's not always possible.

Jason



------------------------------

Date: 20 Jun 2001 12:44:25 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Fetching CGI data as a hash (was DBM in a CGI)
Message-Id: <slrn9j16mr.vch.rgarciasuarez@rafael.kazibao.net>

Jason Clifford wrote in comp.lang.perl.misc:
} > upgrade your CGI.pm.
} 
} In an ideal world however where a script is hosted on someone else's box
} that's not always possible.

perldoc -q 'own module'

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


------------------------------

Date: Wed, 20 Jun 2001 14:50:29 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: Fetching CGI data as a hash (was DBM in a CGI)
Message-Id: <Pine.LNX.4.30.0106201448490.30433-100000@s1.uklinux.net>

On 20 Jun 2001, Rafael Garcia-Suarez wrote:

> } > upgrade your CGI.pm.
> }
> } In an ideal world however where a script is hosted on someone else's box
> } that's not always possible.
>
> perldoc -q 'own module'

Yes however it's not always feasable.

Many people only have access to small amounts of space in which to host
their scripts.

In this case a simple solution is available. It uses a handful of
characters and is far quicker than installing other versions of modules
locally.

Jason



------------------------------

Date: 20 Jun 2001 09:23:05 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Get all the possibilities
Message-Id: <m3wv67cjsm.fsf@dhcp9-173.support.tivoli.com>

On 19 Jun 2001, ren@tivoli.com wrote:

> On Tue, 19 Jun 2001, mblanche@uclink.berkeley.edu wrote:
> 
>> I am trying to write a small Perl script that display all the
>> possible strings from 1 character long to x characters long using a
>> 4 letter alphabet (A,G,C,T). I mean A\n C\n G\n T\n AA\n AC\n AG\n
>> AT\n CA\n etc... I am sure this is pretty simple but I donšt have
>> the training to resolve the issue.
> 
> I believe a similar question has been asked recently on this group.
> A groups.google.com search for "permutations" might reveal it.
> 
> Here's one solution that I just threw together (meaning I think it
> works OK, but it isn't thoroughly tested):
> 
[Solution to wrong problem snipped]

Silly me... not until I saw Craig Berry's solution did I realized that
I had solved the wrong problem.  (Apologies to Greg Bacon and Jay
Tilton for not noticing after either of their posts.)

-- 
Ren Maddox
ren@tivoli.com


------------------------------

Date: 20 Jun 2001 06:41:57 -0700
From: ELI@PELEPHONE.CO.IL (Eli)
Subject: How i Install module in NT platform
Message-Id: <3e7e9299.0106200541.4d56b3fe@posting.google.com>

hi all

how i install module on NT platform
i get the instruction from the wab
after i unzip the zip file
i get into the new create directory
the step that i sould do is :
1. perl Makefile.pl
2. Dmake
3.Dmake test
4.Dmake install

but after i run the first step , i can't run make or dmake
i try also perl -V:Dmake but noting done
unother think there are missing the install file of it ok


if some one can tall me step by stap how to install ?


------------------------------

Date: 20 Jun 2001 06:45:46 -0700
From: ELI@PELEPHONE.CO.IL (Eli)
Subject: How i Install Perl module in NT platform
Message-Id: <3e7e9299.0106200545.53f92a8c@posting.google.com>

hi all

how i install module on NT platform
i get the instruction from the wab
after i unzip the zip file
i get into the new create directory
the step that i sould do is :
1. perl Makefile.pl
2. Dmake
3.Dmake test
4.Dmake install

but after i run the first step , i can't run make or dmake
i try also perl -V:Dmake but noting done
unother think there are missing the install file of it ok


if some one can tall me step by stap how to install ?


------------------------------

Date: Wed, 20 Jun 2001 16:11:18 +0200
From: Philip Newton <pne-news-20010620@newton.digitalspace.net>
Subject: Re: How i Install Perl module in NT platform
Message-Id: <tlb1jtk237ngci100kfaiefqmhvakv85s2@4ax.com>

On 20 Jun 2001 06:45:46 -0700, ELI@PELEPHONE.CO.IL (Eli) wrote:

> how i install module on NT platform

The easiest way, with ActivePerl, is with ppm. If you are using the
ActivePerl distribution (likely, since you're on NT), and the module you
want to use is available pre-packaged with ppm (quite a few of CPAN's
modules are, at least for AP >= 620 or so), then it's as simple as

    C> ppm install The-Module

for The::Module.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: 20 Jun 2001 07:01:12 -0700
From: ELI@PELEPHONE.CO.IL (Eli)
Subject: How i Send E-mail
Message-Id: <3e7e9299.0106200601.77ea25bf@posting.google.com>

hi folks
How i can send mail in NT Platform
if some one can tall me which module i need to use
and if possible to bring url that can give me some exapmle


------------------------------

Date: Wed, 20 Jun 2001 16:09:54 +0200
From: Philip Newton <pne-news-20010620@newton.digitalspace.net>
Subject: Re: How i Send E-mail
Message-Id: <rjb1jtcua61rrv547rurrna2te4c8fa7nu@4ax.com>

On 20 Jun 2001 07:01:12 -0700, ELI@PELEPHONE.CO.IL (Eli) wrote:

> How i can send mail in NT Platform

What version of Perl are you using? If you're using ActivePerl, you can
fetch a precompiled version of e.g. Net::SMTP with ppm. I believe
Mail::Mailer and a couple of others should also be around. For
Net::SMTP, do the following:

    C> ppm install libnet

Then read the embedded documentation.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: Wed, 20 Jun 2001 10:33:07 -0400
From: "Jeff Boes" <jboes@nexcerpt.com>
Subject: Re: Looking for descriptions of IngPerl Functions and Variables in Perl v5
Message-Id: <9gqc5t$86h$1@taliesin.netcom.net.uk>

In article <GF6psE.uLr@alfalfa.utcs.utoronto.ca>, "Daniel Czajko"
<czajko@ocas.on.ca> wrote:

> Anybody knows where I can find those descriptions?
> 

I'm guessing you mean the add-on package of Perl to access Ingres
databases? I found 1,450 hits at Google, why don't you see what you can
find?

(If you're really too busy, here's one:

http://www.contrib.andrew.cmu.edu/~lfm/ingperl.html

-- 
Jeff Boes                                             vox 616.226.9550
Database Engineer                                     fax 616.349.9076
Nexcerpt, Inc.                                      jboes@nexcerpt.com


------------------------------

Date: Wed, 20 Jun 2001 09:32:22 +0100
From: Jeremy Gurney <Jeremy.Gurney@protherics.com>
Subject: Re: OLE automation w/ MS Word
Message-Id: <3B305F96.4AA32B0B@protherics.com>

G Chew wrote:

> The script as a whole does what I want it to do when I tested it out
> on my desktop PC (Win 98, Office 2000).  However, when I copied it to
> a web server (Win NT, Office 2000 installed), I get the following
> message:
>
> Oops, cannot start Word:Win32::OLE(0.1501) error 0x8001010a: "The
> message filter indicated that the application is busy" at
> F:\inetpub\www\scripts\FatMat.pl line 842.

If the web server is running is a service then it needs to be running
under the local system account to be able to use OLE. If you have it
running under a user account then your CGIs can access network resources
but not OLE, it's a trade off. Aparantly this is a design feature in NT.

Jeremy Gurney                |  Protherics Molecular Design Ltd.
"The views, opinions, and judgements expressed in this
message are solely those of the author. The message contents
have not been reviewed or approved by Protherics."



------------------------------

Date: Wed, 20 Jun 2001 14:47:15 +0200
From: Danny Hendrickx <daniel.hendrickx@alcatel.be>
Subject: ord() and ...?
Message-Id: <3B309B53.BE8C1D9C@alcatel.be>

Hello,

I know I can use ord() to get the ASCII value of a character. But
suppose I want to change this character by modifying the ASCII value
afterwards, how would I do that?

My goal is to convert lowercase to uppercase, so with ord() I can check
if it is a lowercase alphabetical character, but how do I change the
character then ?

I know I could include the c library to use tolower and toupper, but how
do I do this in perl ?
-- 
Regards,
                                                ________________
________________________________________________\              /_____
 Feature Development Team Leader WR2A team 7 Services and SAD /
 SW-Engineering - Routing - VJ33                Hendrickx Danny
 phone : +32-3-240 3916                         ALCATEL  TELECOM
 fax   : +32-3-240 9899                         Fr.Wellesplein 1
 mailto:daniel.hendrickx@alcatel.be           2018 Antwerp Belgium
______________________________________________________\  /___________
URL: http://www.se.bel.alcatel.be/CH_sector1/SS31/     \/
*********************************************************************
Why can't you make any other word with the letters of 'anagram' ?
*********************************************************************


------------------------------

Date: Wed, 20 Jun 2001 15:05:08 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: ord() and ...?
Message-Id: <9gq72p$aei$1@dinkel.civ.utwente.nl>

uc() converts to uppercase
lc() ...duh
chr() is the reverse of ord()

--
carlos
:wq
"Danny Hendrickx" <daniel.hendrickx@alcatel.be> wrote in message
news:3B309B53.BE8C1D9C@alcatel.be...
> Hello,
>
> I know I can use ord() to get the ASCII value of a character. But
> suppose I want to change this character by modifying the ASCII value
> afterwards, how would I do that?
>
> My goal is to convert lowercase to uppercase, so with ord() I can check
> if it is a lowercase alphabetical character, but how do I change the
> character then ?
>
> I know I could include the c library to use tolower and toupper, but how
> do I do this in perl ?
> --
> Regards,
>                                                 ________________
> ________________________________________________\              /_____
>  Feature Development Team Leader WR2A team 7 Services and SAD /
>  SW-Engineering - Routing - VJ33                Hendrickx Danny
>  phone : +32-3-240 3916                         ALCATEL  TELECOM
>  fax   : +32-3-240 9899                         Fr.Wellesplein 1
>  mailto:daniel.hendrickx@alcatel.be           2018 Antwerp Belgium
> ______________________________________________________\  /___________
> URL: http://www.se.bel.alcatel.be/CH_sector1/SS31/     \/
> *********************************************************************
> Why can't you make any other word with the letters of 'anagram' ?
> *********************************************************************




------------------------------

Date: Wed, 20 Jun 2001 14:16:38 +0100
From: "W K" <bill.kemp@wire2.com>
Subject: Re: ord() and ...?
Message-Id: <993043084.9964.0.nnrp-08.c3ad6974@news.demon.co.uk>


carlos wrote in message <9gq72p$aei$1@dinkel.civ.utwente.nl>...
>uc() converts to uppercase
>lc() ...duh
>chr() is the reverse of ord()
>


OP. New to perl?
If its useful then its already there.
What about this
perl -e '$a="perl";$b="PERL"; print ucfirst($a),"  ", lcfirst($b) '




------------------------------

Date: Wed, 20 Jun 2001 13:19:45 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: ord() and ...?
Message-Id: <slrn9j18uk.ctb.bernard.el-hagin@gdndev32.lido-tech>

On Wed, 20 Jun 2001 14:47:15 +0200, Danny Hendrickx
<daniel.hendrickx@alcatel.be> wrote:
>Hello,
>
>I know I can use ord() to get the ASCII value of a character. But
>suppose I want to change this character by modifying the ASCII value
>afterwards, how would I do that?
>
>My goal is to convert lowercase to uppercase, so with ord() I can check
>if it is a lowercase alphabetical character, but how do I change the
>character then ?
>
>I know I could include the c library to use tolower and toupper, but how
>do I do this in perl ?

You can use uc() and lc() or, if you *really* want to use the ASCII codes
check out the chr() function which does the opposite of what ord does.

Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'


------------------------------

Date: Wed, 20 Jun 2001 15:51:41 +0200
From: Danny Hendrickx <daniel.hendrickx@alcatel.be>
Subject: Re: ord() and ...?
Message-Id: <3B30AA6D.C1CCD239@alcatel.be>

Thank you all who responded.
You've been a great help.

Danny Hendrickx wrote:
> 
> Hello,
> 
> I know I can use ord() to get the ASCII value of a character. But
> suppose I want to change this character by modifying the ASCII value
> afterwards, how would I do that?
> 
> My goal is to convert lowercase to uppercase, so with ord() I can check
> if it is a lowercase alphabetical character, but how do I change the
> character then ?
> 
> I know I could include the c library to use tolower and toupper, but how
> do I do this in perl ?
> --
> Regards,
>                                                 ________________
> ________________________________________________\              /_____
>  Feature Development Team Leader WR2A team 7 Services and SAD /
>  SW-Engineering - Routing - VJ33                Hendrickx Danny
>  phone : +32-3-240 3916                         ALCATEL  TELECOM
>  fax   : +32-3-240 9899                         Fr.Wellesplein 1
>  mailto:daniel.hendrickx@alcatel.be           2018 Antwerp Belgium
> ______________________________________________________\  /___________
> URL: http://www.se.bel.alcatel.be/CH_sector1/SS31/     \/
> *********************************************************************
> Why can't you make any other word with the letters of 'anagram' ?
> *********************************************************************

-- 
Regards,
                                                ________________
________________________________________________\              /_____
 Feature Development Team Leader WR2A team 7 Services and SAD /
 SW-Engineering - Routing - VJ33                Hendrickx Danny
 phone : +32-3-240 3916                         ALCATEL  TELECOM
 fax   : +32-3-240 9899                         Fr.Wellesplein 1
 mailto:daniel.hendrickx@alcatel.be           2018 Antwerp Belgium
______________________________________________________\  /___________
URL: http://www.se.bel.alcatel.be/CH_sector1/SS31/     \/
*********************************************************************
If today it's 0 degrees and it gets twice as cold tomorrow, how cold
will it be ?
*********************************************************************


------------------------------

Date: Wed, 20 Jun 2001 14:41:53 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: ord() and ...?
Message-Id: <gdd1jtcimruhihqvs8qibaheugpq2n7uq6@4ax.com>

Danny Hendrickx wrote:

>I know I can use ord() to get the ASCII value of a character. But
>suppose I want to change this character by modifying the ASCII value
>afterwards, how would I do that?

Using

	s/([charclass])/somefunc($1)/ge

or with

	substr($string, $pos, 1) = "*";	 # replace a character


>My goal is to convert lowercase to uppercase, so with ord() I can check
>if it is a lowercase alphabetical character, but how do I change the
>character then ?

Perl has several functions built-in. see uc(), ucfirst(), lc(), but also
"\u", "\U", "\l", "\L" in strings. For example:

	$me = 'BART';
	print "\u\L$me\n";
-->
	Bart

"\L" makes everything that follows lowercase, up to an "\E" if it
exists. "\u" makes 1 character uppercase. As you can see, you can stack
them, so "\u\L" makes the first character uppercase, and the rest
lowercase.

-- 
	Bart.


------------------------------

Date: Wed, 20 Jun 2001 11:43:00 GMT
From: mikee@kensho.eggtech.com (Mike Eggleston)
Subject: Re: parsing log file
Message-Id: <slrn9j1324.pmm.mikee@kensho.eggtech.com>

On 19 Jun 2001 09:14:45 -0700, darrin <dthusma@balsasoft.com> wrote:
> "kevin" <emailkevin@charter.net> wrote in message news:<titgl8jpfkj5bf@corp.supernews.com>...
>> Can someone tell me a simple way to read a log file and act on it?...I mean
>> a REAL log file...one that is constantly updated...I need to know how to
>> read each new line as it comes in and take some action.  Any reference I
>> find is for a static log file...not a dynamic,  new entry a minute, log
>> file....ANY help appreciated!!
>> 
>> thanks

Or use swatch


------------------------------

Date: Wed, 20 Jun 2001 21:38:33 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: premature end of script or malformed header
Message-Id: <L10Y6.18$by2.778343@news.interact.net.au>


"Christophe Gibert" <christophe@e-xode.com> wrote in message
news:3B2F6816.A9D937C5@e-xode.com...
> I am running a cgi script written in perl that causes an internal server
>
> error. the error logs say "premature end of script" or "malformed header
>
> from script" but the script is running when it is launched from the
> shell. And it is so simple that it it can not be wrong
> My server is apache 1.3.14
>
> What'ts wrong ?

It's obviously not as simple as you think.  Post the first few lines of the
script.




------------------------------

Date: Wed, 20 Jun 2001 13:44:29 +0200
From: "Stefan Serena" <sserena@freesurf.ch>
Subject: Reference-problem
Message-Id: <9gq2b4$dds$1@news1.sunrise.ch>

Hi!

What's wrong? It doesn't cause an error, but I want it to print "Hello
World!"...

@foo = ('bar', 'anything');
$$foo[0] = "Hello World!";
print $bar;

Thx!




------------------------------

Date: 20 Jun 2001 11:55:53 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Reference-problem
Message-Id: <slrn9j13rr.ul1.rgarciasuarez@rafael.kazibao.net>

Stefan Serena wrote in comp.lang.perl.misc:
} Hi!
} 
} What's wrong? It doesn't cause an error, but I want it to print "Hello
} World!"...
} 
} @foo = ('bar', 'anything');
} $$foo[0] = "Hello World!";
} print $bar;

You should write
${$foo[0]} = "Hello World!";

Note also that this doesn't work with the 'strict' pragma enabled.
The use of symbolic references is often discouraged when maintainability
should be taken into account. Perhaps can you use a hash instead?

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


------------------------------

Date: Wed, 20 Jun 2001 12:33:11 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: Regexps, using variables to get $1, $2, etc.
Message-Id: <9gpu57$4pq$1@dinkel.civ.utwente.nl>

single quotes dont substitute variables

--
carlos

"Egghead" <googlenews@edge-web.com> wrote in message
news:tivaek8bf22n77@corp.supernews.com...
> I'd like to take a string, match and store patterns within the string
using
> a regexp defined in a variable ($match) which stores values in $1, $2, $`,
etc.
> Then I'd like to get the data contained in the read-only variables and
> manipulate it with another variable ($replace).
>
> Sorry, can't describe it better than that. Here's the script:
>
> $string = 'this.20010420162000.txt';
> $match = '^th(.*?)\.(\d{14})\.txt$';
> $replace = '$1.during.$2';
>
> if($string =~ /$match/) {
>   # what to do now? $replace should be 'is.during.20010420162000'
>   # I've tried:
>   # $new = $replace;
>   # $new = eval($replace);
>   # some other variants of the same
>   # none work
> }
>
> If this is documented anywhere I'd love to see it, maybe I need to use map
or
> something like that, I just can't figure it out. Appreciate your input.
>
> thanks!




------------------------------

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 1164
***************************************


home help back first fref pref prev next nref lref last post