[10383] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3976 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 14 19:07:14 1998

Date: Wed, 14 Oct 98 16:00:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 14 Oct 1998     Volume: 8 Number: 3976

Today's topics:
    Re: Are there no PERL experts out there?? Is there no o <uri@camel.fastserv.com>
    Re: Are there no PERL experts out there?? Is there no o (David Alan Black)
    Re: Are there no PERL experts out there?? Is there no o (Martien Verbruggen)
    Re: Are there no PERL experts out there?? Is there no o (Martien Verbruggen)
    Re: Are there no PERL experts out there?? Is there no o <uri@camel.fastserv.com>
    Re: Are there no PERL experts out there?? Is there no o (Martien Verbruggen)
    Re: Are there no PERL experts out there?? Is there no o (Abigail)
    Re: Are there no PERL experts out there?? Is there no o (Larry Rosler)
    Re: Batch-changing URL case in HTML pages with perl <rootbeer@teleport.com>
    Re: Batch-changing URL case in HTML pages with perl (brian d foy)
    Re: Compressing and Uncompressing (Martien Verbruggen)
    Re: Compressing and Uncompressing <eashton@bbnplanet.com>
    Re: Deleteing a line (David Alan Black)
    Re: exit code... <george.kuetemeyer@mail.tju.edu>
        ftp.pl perl ftp library <arranp@datamail.co.nz>
        Help! Structures in Perl <wcoarseyREMOVETHIS@gate.net>
    Re: Help! Structures in Perl <rootbeer@teleport.com>
    Re: Help! Structures in Perl <uri@camel.fastserv.com>
        how to remove trailing spaces? (Antti-Jussi Korjonen)
    Re: how to remove trailing spaces? (Martien Verbruggen)
    Re: how to remove trailing spaces? <uri@camel.fastserv.com>
    Re: matching problems <rick.delaney@shaw.wave.ca>
    Re: newbie: multidim array format <rootbeer@teleport.com>
    Re: newbie: multidim array format (Mark-Jason Dominus)
    Re: perl plotting tool? <huang2@andrew.cmu.edu>
    Re: Sorry (Larry Wall)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 14 Oct 1998 18:13:30 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: Webby@cryogen.com
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <sard87urdv9.fsf@camel.fastserv.com>

>>>>> "W" == Webby  <Webby@cryogen.com> writes:

  W> Hello, I'm making a form so users can send me information.  The
  W> also have to send me their name. How do I check and see if the name
  W> only consists of letters and white spaces?? So "My Name" is allowed
  W> but "Jj&*d d#fdhd" is not allowed!!! I want to send a message
  W> saying that the name was invalid! But how do I check and see if the
  W> name is valid? I've posted this questions several times in this
  W> newsgroup and other CGI newsgroup and CGI forums. I've tried all
  W> the suggestions but none of them work!! I'm a newbie to PERL, but
  W> this seems like a very easy question and there must be someone out
  W> there that knows the answer!! Here are a few sufggestions I got
  W> that don't work!!

what do you mean they don't work? and why did you post this twice with
different names?

  W> 1.  if ( /\w/ ) {

  W>       # do something

  W>    } else {

  W>       # do something else } }

this only checks if any char is a word char (a-zA-Z_ depending on
locale). so most bogus names will pass

  W> 2. /^[a-zA-Z0-9]+$/

you don't allow spaces here. otherwise it looks ok.  it is anchored and
checks all the chars to be in the set.  what didn't work here? give
examples of real code you tried that failed.

  W> 3. $something =~ /^-?[a-zA-Z0-9.]+$/;

what do you want from -? ? that is an optional leading '-' which is not
what you seem to want.

  W> $something =~ /[a-zA-Z0-9.]/;

this again only matches one char in that set. and . there is just .

  W> 4. $something =~ /^\w+$/;

this is better than one but misses blanks again. as well as digits if
you want them (you seem to earlier).  but again at least it is anchored
and checks all the chars.

  W> 5. /^[^\W_]*$/ # Matches "" or "\n"

well that is because you use * and not +. read perlre again (and again,
and again...). also get and read "mastering regular expressions" by
friedl which will help your misunderstandings about regexes.

  W> or

  W> /^[^\W_]+$/ # Requires at least one letter or digit

this doesn't allow balnks. 

  W> 6. if( $a =~ /[^a-zA-Z ]+/ || $a !~ /\w/ ){ do error thing }

this last one make the least sense of all.

you seem to keep trying things without any logical understanding, like
you will randomly hit upon the magical regex to do what you want. try to
think more clearly. you have most of the correct ideas here but you
don't put the pieces together. some have anchors (needed to make sure
the WHOLE string is what you want), some have positive and other
negative character classes (one or the other will work, just pick the
class carefully).

  W> PLEASE HELP!!!!

ask nicely and don't say there are no experts out here. you haven't
posted this before that i have seen. nor is your subject going to endear
you to this group. just ask a plain a simple question about why your
regexes don't do what you think they should.

so try it again with my feedback and you should come up with a
solution. you are circling around it (like with one foot nailed to the
floor). just decide which chars you want in the name, make a char class
with that, anchor it, make it take up ALL the chars in the string (the +
modifier does that).

i have done all but write the code.

use the force, grasshopper! (mixed media :-)

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 14 Oct 1998 18:31:43 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <7038of$9fb$1@pilot.njin.net>

Hello -

Rafely@xxiname.com writes:

>Hello,

>I'm making a form so users can send me information.
>The also have to send me their name. How do I check
>and see if the name only consists of letters and white
>spaces?? So "My Name" is allowed but "Jj&*d d#fdhd"
>is not allowed!!! I want to send a message saying that
>the name was invalid! But how do I check and see if
>the name is valid? I've posted this questions several
>times in this newsgroup and other CGI newsgroup and
>CGI forums. I've tried all the suggestions but none of


comp.lang.perl.misc isn't a CGI newsgroup.  It's a Perl
(not PERL) newsgroup.  


>them work!! I'm a newbie to PERL, but this seems like
>a very easy question and there must be someone out
>there that knows the answer!! Here are a few
>sufggestions I got that don't work!!

It isn't a very easy question.  Well, it's easy to do what you
literally asked for:

/^([^\W\d_]|\s)+$/

but that isn't a very good real-world solution.  People do have
punctuation in their names, you know.  Why, that's even true of
some of those phantom "PERL" experts who have failed to deliver
the goods to you.  You wouldn't want Mark-Jason to suffer the
disappointment of being rejected by your script, now would you?

Of course, the literal solution also allows for names consisting
entirely of spaces.  That's pretty phantom-like, and perhaps
will suit your purposes after all.


David A.<-- note the period  Black
dblack@pilot.njin.net


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

Date: Wed, 14 Oct 1998 22:38:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <_J9V1.62$AA3.77406@nsw.nnrp.telstra.net>

That might be the snottiest subject line I've seen in a while.

In article <362629d5.3844150@news.iaehv.nl>,
	Webby@cryogen.com writes:
> Hello,
> 
> I'm making a form so users can send me information.
> The also have to send me their name. How do I check
> and see if the name only consists of letters and white

# perldoc perlre
# perldoc perlop

$name =~ /^[\w\s]+$/;

Although the above will also include '_'. Read perlre to find out more.

> times in this newsgroup and other CGI newsgroup and

If you choose your subject as carefully as you did this time, it's no
wonder no one ever replies. Do yourself a favour, and read:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> 1.  if ( /\w/ ) {

	This only checks to see if the string in $_ _contains_ _one_ word
	character, which is defined as alphanumeric plus '_'.

> 2. /^[a-zA-Z0-9]+$/

	This ignores any characters outside of that range, like accented
	vowels, stuff like that. It also doesn't allow whitespace.

> 3. $something =~ /^-?[a-zA-Z0-9.]+$/;

	This allows a possible leading minus sign, for whatever reason,
	and a dot, which might be handy for titles or stuff. it does not
	allow whitespace.

> $something =~ /[a-zA-Z0-9.]/;

	Again, without the anchors at the beginning and end, and the +
	quantifier, this will only check for _one_ character in that
	class. '!@###%a$#^%' will be valid.

> 4. $something =~ /^\w+$/;

	This doesn't allow whitespace.

> 5. /^[^\W_]*$/	# Matches "" or "\n"

	This allows everything, that is _not_ a non-word character, and
	_not_ an underscore. It allows the empty string.

> /^[^\W_]+$/	# Requires at least one letter or digit
	
	This should work.

> 6. if( $a =~ /[^a-zA-Z ]+/ || $a !~ /\w/ ){ do error thing }

	This is outright silly.

> PLEASE HELP!!!!

Please, don't shout. You already had the answer. You also already had
documentation that you could have consulted. Maybe my added comments
will urge you to try to understand the regular expressions, while
reading the manual.

# perldoc perlre

For the next time: Give it a try. if you still can't figure it out,
please, post again, but choose a sensible subject line. Include some
code that shows what you are doing. You might be doing something else
wrong, besides the regexp.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.       | the people out there are dumber.
NSW, Australia                      | 


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

Date: Wed, 14 Oct 1998 22:44:27 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <fP9V1.63$AA3.77406@nsw.nnrp.telstra.net>

In article <sard87urdv9.fsf@camel.fastserv.com>,
	Uri Guttman <uri@camel.fastserv.com> writes:

>   W> 4. $something =~ /^\w+$/;
> 
> this is better than one but misses blanks again. as well as digits if
> you want them (you seem to earlier).  but again at least it is anchored
> and checks all the chars.

\w includes digits. alphanumerics plus '_'. It just misses blanks.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd.       | things get worse.
NSW, Australia                      | 


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

Date: 14 Oct 1998 18:47:49 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <saraf2yrca2.fsf@camel.fastserv.com>

>>>>> "MV" == Martien Verbruggen <mgjv@comdyn.com.au> writes:

  MV> In article <sard87urdv9.fsf@camel.fastserv.com>, Uri Guttman
  MV> <uri@camel.fastserv.com> writes:

  W> 4. $something =~ /^\w+$/;
  >>  this is better than one but misses blanks again. as well as digits
  >> if you want them (you seem to earlier).  but again at least it is
  >> anchored and checks all the chars.

  MV> \w includes digits. alphanumerics plus '_'. It just misses blanks.

i know that. i was just pointing out why it would fail on 'my name'.
i was trying to educate her, not give her the direct answer.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Wed, 14 Oct 1998 22:51:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <QV9V1.66$AA3.77406@nsw.nnrp.telstra.net>

In article <saraf2yrca2.fsf@camel.fastserv.com>,
	Uri Guttman <uri@camel.fastserv.com> writes:
>>>>>> "MV" == Martien Verbruggen <mgjv@comdyn.com.au> writes:
> 
>   MV> In article <sard87urdv9.fsf@camel.fastserv.com>, Uri Guttman
>   MV> <uri@camel.fastserv.com> writes:
> 
>   W> 4. $something =~ /^\w+$/;
>   >>  this is better than one but misses blanks again. as well as digits
>   >> if you want them (you seem to earlier).  but again at least it is
>   >> anchored and checks all the chars.
> 
>   MV> \w includes digits. alphanumerics plus '_'. It just misses blanks.
> 
> i know that. i was just pointing out why it would fail on 'my name'.
> i was trying to educate her, not give her the direct answer.

You're confusing me. You say you know \w includes blanks, but in your
earlier post you say 'but misses blanks again. as well as digits'. Am
I just misreading that?

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


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

Date: 14 Oct 1998 22:53:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <703a1o$eul$2@client3.news.psi.net>

Rafely@xxiname.com (Rafely@xxiname.com) wrote on MDCCCLXX September
MCMXCIII in <URL:news:362525ae.2780681@news.iaehv.nl>:
++ 
++ The also have to send me their name. How do I check
++ and see if the name only consists of letters and white
++ spaces?

One reads the documentation.




Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: Wed, 14 Oct 1998 15:45:53 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve this??
Message-Id: <MPG.108ec97eb3de304398980e@nntp.hpl.hp.com>

In article <7038of$9fb$1@pilot.njin.net> on 14 Oct 1998 18:31:43 -0400, 
David Alan Black <dblack@pilot.njin.net> says...
 ...
! It isn't a very easy question.  Well, it's easy to do what you
! literally asked for:
! 
! /^([^\W\d_]|\s)+$/
! 
! but that isn't a very good real-world solution.  People do have
! punctuation in their names, you know.  Why, that's even true of
! some of those phantom "PERL" experts who have failed to deliver
! the goods to you.  You wouldn't want Mark-Jason to suffer the
! disappointment of being rejected by your script, now would you?

Don't forget Tim O'Reilly either!  Or Alfred E. Neuman, for that matter.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 14 Oct 1998 21:48:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Batch-changing URL case in HTML pages with perl
Message-Id: <Pine.GSO.4.02A.9810141447280.1979-100000@user2.teleport.com>

On Wed, 14 Oct 1998, Gordon Rankin wrote:

> Path: ralph.vnet.net!not-for-mail
> From: macalex@nospamvnet.net (Gordon Rankin)
> Newsgroups: comp.infosystems.www.authoring.html
> Subject: Changing URL case automatically
> Message-ID: <362498a7.13268960@news.vnet.net>
> X-Newsreader: Forte Free Agent 1.11/32.235
> Lines: 14
> Date: Wed, 14 Oct 1998 12:30:39 GMT
> NNTP-Posting-Host: 166.82.9.154
> X-Trace: ralph.vnet.net 908368479 166.82.9.154 (Wed, 14 Oct 1998
> 08:34:39 EDT)
> NNTP-Posting-Date: Wed, 14 Oct 1998 08:34:39 EDT
> Organization: Vnet Internet Access
> Xref: ralph.vnet.net comp.infosystems.www.authoring.html:13747

What was all that for? Those weren't headers on your message, they were
text included within your message.

> Is anyone aware of any perl scripts, shareware utilities, or programs
> etc. that will open a batch of HTML files, change the case of URLs in
> the file from mixed or upper to all lower case, and save the file? 

No, but it wouldn't be hard to write one with the help of HTML::Parser,
which you can find on CPAN.

> If replying to me via email, please remove the "nospam" from my
> address.

If you want replies via email, please remove the "nospam" from your
address.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 14 Oct 1998 18:26:52 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Batch-changing URL case in HTML pages with perl
Message-Id: <comdog-ya02408000R1410981826520001@news.panix.com>
Keywords: from just another new york perl hacker

In article <362515d2.1673064@news.vnet.net>, macalex@nospamvnet.net (Gordon Rankin) posted:

>Is anyone aware of any perl scripts, shareware utilities, or programs
>etc. that will open a batch of HTML files, change the case of URLs in
>the file from mixed or upper to all lower case, and save the file? 

URLs are case sensitive.  what problem are you trying to solve?

-- 
brian d foy                                  <comdog@computerdog.com>
Kernel Steve Austin - stronger, faster, threaded
    <URL:http://kernel.steve.austin.pm.org>


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

Date: Wed, 14 Oct 1998 22:22:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Compressing and Uncompressing
Message-Id: <du9V1.59$AA3.77406@nsw.nnrp.telstra.net>

In article <3624255F.6B8DD35@bbnplanet.com>,
	Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> writes:
> Robin Bank wrote:
> 
>> IS there any way to use perl to decompress and compress .tar, .zip, .tar.gz
>> files....etc???
> 
> Of course, have you read the FAQ?

The only reference in the 5.005_02 faq version to 'compress' is the
section 2 answer to the contents of CPAN. The only references to
/g?zip/ are in section  explaining that CPAN holds the archives in
gzipped format, and in section 4, in an example on binary data. 'tar'
shows up a lot with a grep, but only because of the word 'start'.
perldoc -q with keywords like 'compress', 'zip' or 'tar' doesn't spit
out anything useful either.

In other words: I don't think the original poster was asking a
question that deserved a reference to the FAQ without even mentioning
which section and/or question. While it _may_ be in there, it is
certainly not trivial to find it, so a reference would help
tremendously.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.       | again. Then quit; there's no use being
NSW, Australia                      | a damn fool about it.


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

Date: Wed, 14 Oct 1998 22:56:36 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Compressing and Uncompressing
Message-Id: <362529A2.85D479E5@bbnplanet.com>

Martien Verbruggen wrote:

> The only reference in the 5.005_02 faq version to 'compress' is the
> section 2 answer to the contents of CPAN. The only references to

Hmm. I thought I remembered file conversion to be part of the FAQ. It
doesn't appear to be. Ooops. I even looked through the cookbook for a
reference without success, which suprises me as this is an often asked
question.

So, to the original poster, you could try 'perldoc -f {exec,system} to
see how to use the OS commands to convert your files. I don't know of
any modules that will do all of the above....I could be out of date
though.

e.

After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia.  - U. Eco -


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

Date: 14 Oct 1998 18:53:46 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Deleteing a line
Message-Id: <703a1q$9m5$1@pilot.njin.net>

Sorry, I couldn't help laughing at the subject line considering
that I saw this on my screen:

x Keith L. Miller                  39  Deleteing a line
y Keith L. Miller                  39  -
z Keith L. Miller                  39  -
0 Keith L. Miller                  39  -



David Black
dblack@pilot.njin.net


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

Date: Wed, 14 Oct 1998 18:21:52 -0400
From: George Kuetemeyer <george.kuetemeyer@mail.tju.edu>
Subject: Re: exit code...
Message-Id: <36252400.E34AB77E@mail.tju.edu>



Mark-Jason Dominus wrote:

> That means that to get the exit code; you need to use something like this:
>
>         $exit_code = $? >> 8;
>
> A complete analysis of the exit status might look like this:
>
>         $exit_code = ($? & 0xff00) >> 8;
>         $core_dump = ($? & 0x0080);
>         $signal_no = ($? & 0x007f);
>
>         if ($signal_no) {
>           print "Process killed by signal $signal_no";
>           print $core_dump ? " (core dumped)\n" : "\n";
>         } else {
>           print "Process exited with status $exit_code\n";
>         }

Ever since we upgraded our UNIX (HP-UX) box to two processors, we very
sporadically  get a $? value of  16777215. We're at a loss, given that this is
not a 16 bit value (actually 0xffffff). We upgraded Perl to the most recent
version & the problem persists. Any thoughts?




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

Date: Thu, 15 Oct 1998 11:37:03 +1300
From: Arran Price <arranp@datamail.co.nz>
Subject: ftp.pl perl ftp library
Message-Id: <3625278F.305F@datamail.co.nz>

ftp.pl

I have it, I want to use it..
I cant find any docs on how to use it, the script itself dosent say
howto...

Anyone point me to where I can get the docs or how to use it?

cheers

(appreciate an email response)

Arran
My opinions are my own and do not reflect those of my employer.


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

Date: Wed, 14 Oct 1998 18:07:23 -0400
From: "Will" <wcoarseyREMOVETHIS@gate.net>
Subject: Help! Structures in Perl
Message-Id: <7037j0$1a18$1@news.gate.net>

Is it possible to have structures in Perl like in C? I want a structure like
this is Perl:

      struct address {
                char name[40];
                char street[40];
                char city[20];
                char st[3];
                char zip[10];
       }

Next I want and array of these structures like this:

         struct address items[];

If an array of structures are possible, then how would I access individual
element? I C I would do something like this:

     for (i=0; i<5; i++){
         printf("Name = %s\n", items[i].name);
     }

I've just started using Perl and have not quiet got the hang of Perl's data
structures.


Thanks,
--Will
wcoarseyNOSPAM@gate.net
(Please remove the NOSPAM)




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

Date: Wed, 14 Oct 1998 22:48:13 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help! Structures in Perl
Message-Id: <Pine.GSO.4.02A.9810141547160.1979-100000@user2.teleport.com>

On Wed, 14 Oct 1998, Will wrote:

> I've just started using Perl and have not quiet got the hang of Perl's
> data structures.

Have you seen the perldsc manpage? The 'dsc' stands for "data structures
cookbook". There's also perlref and perllol. Hope this helps!

> wcoarseyNOSPAM@gate.net
> (Please remove the NOSPAM)

Please remove the NOSPAM  :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Oct 1998 18:55:36 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Help! Structures in Perl
Message-Id: <sar90iirbx3.fsf@camel.fastserv.com>

>>>>> "W" == Will  <wcoarseyREMOVETHIS@gate.net> writes:

  W> Is it possible to have structures in Perl like in C? I want a
  W> structure like this is Perl:

yes.

  W>       struct address {
  W>                 char name[40];
  W>                 char street[40];
  W>                 char city[20];
  W>                 char st[3];
  W>                 char zip[10];
  W>        }

  W> Next I want and array of these structures like this:

  W>          struct address items[];

what a novel idea! we should have this in perl! BTW this is not an array
of address structs, but an empty pointer to one.

  W> If an array of structures are possible, then how would I access
  W> individual element? I C I would do something like this:

  W>      for (i=0; i<5; i++){
  W>          printf("Name = %s\n", items[i].name);
  W>      }

really! i would never have know how to do that before this post! data
structures in C were very difficult for me. :-)

if you ran this, it would core dump since items is a NULL pointer.

  W> I've just started using Perl and have not quiet got the hang of
  W> Perl's data structures.

perldoc perldsc will help. also a good book like learning perl should be
acquired and devoured. post again after you have done so.

hth,

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 14 Oct 1998 22:44:14 GMT
From: aajii@raaseri.ton.tut.fi (Antti-Jussi Korjonen)
Subject: how to remove trailing spaces?
Message-Id: <7039fu$pge$1@baker.cc.tut.fi>

How do I remove trailing spaces?
$temp=~ tr/\s$//d; this doesn't work, what would?

--
  
         __/                __/ __/  __/     Antti-Jussi Korjonen
      __/ __/    __/       __/ __/__/       Vaajakatu 5 D 85
    __/    __/      __/   __/ __/__/       33720 TAMPERE, FINLAND
  __/       __/    __/__/__/ __/  __/     tel. +358-(0)40-577 83 23
                                         Antti-Jussi.Korjonen@sonera.fi
   --------->>  http://www.students.tut.fi/~k150556  <<---------
     


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

Date: Wed, 14 Oct 1998 22:53:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: how to remove trailing spaces?
Message-Id: <EX9V1.67$AA3.77406@nsw.nnrp.telstra.net>

In article <7039fu$pge$1@baker.cc.tut.fi>,
	aajii@raaseri.ton.tut.fi (Antti-Jussi Korjonen) writes:
> How do I remove trailing spaces?
> $temp=~ tr/\s$//d; this doesn't work, what would?

That is not what tr/// is for. 

# perldoc perlop

You can find the answer you are looking for in the perl FAQ, which co0mes with perl.

# perldoc -q blank
# perldoc perlfaq4
/How do I strip blank space from the beginning/end of a string?

Do yourself a favour, and learn how to use the documentation.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | The gene pool could use a little
Commercial Dynamics Pty. Ltd.       | chlorine.
NSW, Australia                      | 


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

Date: 14 Oct 1998 18:59:26 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: how to remove trailing spaces?
Message-Id: <sar7ly2rbqp.fsf@camel.fastserv.com>

>>>>> "AK" == Antti-Jussi Korjonen <aajii@raaseri.ton.tut.fi> writes:

  AK> How do I remove trailing spaces?  $temp=~ tr/\s$//d; this doesn't
  AK> work, what would?

you are crossing the syntax of s/// and tr// which are very different
animals. 

try this for the answer:

perldoc perlfaq4

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Wed, 14 Oct 1998 22:15:22 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: matching problems
Message-Id: <36252412.6932B479@shaw.wave.ca>

[posted & mailed]

Troy Bull wrote:
> 
> I have a small program that does a search of the form
> 
> s/(\w{3}):(\w{3})/wrap stuff around $1 and $2/g
> 
> the problem is that it matches one case that I need for it not to
> ___:___ needs to not match  this is the only case that needs to
> fail, if any one of the six underscores is a [a-zA-Z0-9] it should
> match.

    s/(?!___:___)(\w{3}):(\w{3})/wrap stuff around $1 and $2/g;

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Wed, 14 Oct 1998 21:46:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: newbie: multidim array format
Message-Id: <Pine.GSO.4.02A.9810141445190.1979-100000@user2.teleport.com>

On Wed, 14 Oct 1998, Michael D Sohn wrote:

> Subject: newbie: multidim array format

Contrary to popular opinion, it doesn't help to use the word "newbie" in
your subject line. On the contrary, it's likely to bother the folks who
might choose to answer you.

> I've been reading the manuals but I can't seem to understand how to
> setup and manipulate multidimensional arrays.

Have you seen the perlref, perllol, and perldsc manpages? Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Oct 1998 18:31:42 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: newbie: multidim array format
Message-Id: <7038oe$bop$1@monet.op.net>

In article <0q9F_O200YUf092us0@andrew.cmu.edu>,
Michael D Sohn  <msda+@andrew.cmu.edu> wrote:
>I would like to read this file into a variable/array and so that I can
>do stuff to any of the `cells'.  Something like:
>
>A[2][3] = 4 + A[4][1]

See the `perllol' manual page, which is distributed with Perl.  Try
`man perllol' or `perldoc perllol' to view it, or look on the Perl web
site.

Or see http://www.plover.com/~mjd/perl/FAQs/References.html, which
has an example of exactly this.  



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

Date: Wed, 14 Oct 1998 18:14:12 -0400
From: Cathy Huang <huang2@andrew.cmu.edu>
Subject: Re: perl plotting tool?
Message-Id: <36252234.7D9C5F00@andrew.cmu.edu>

BTW, this is for WinNT..
Cathy

Cathy Huang wrote:

> Can anyone recommend a perl graphing tool that only requires perl 5.001?
> I've looked at pgperl
> (http://www.aao.gov.au/local/www/kgb/pgperl/)- are there any other good
> ones? I need to generate html graphs.
>
> Thanks-
> Cathy





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

Date: 14 Oct 1998 15:46:10 -0700
From: larry@kiev.wall.org (Larry Wall)
Subject: Re: Sorry
Message-Id: <7039ji$mtk@kiev.wall.org>

In article <36250D93.9044862E@min.net>, John Porter  <jdporter@min.net> wrote:
>Tad McClellan wrote:
>> 
>>    New stuff, even stupid new stuff, is welcomed.
>
>Right; like "Why is Perl so much worse than Python?"

That's easy.  Perl is worse than Python because people wanted it worse.

Larry


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3976
**************************************

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