[22160] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4381 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 10 18:11:07 2003

Date: Fri, 10 Jan 2003 15:10:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 10 Jan 2003     Volume: 10 Number: 4381

Today's topics:
    Re: parsing xml with perl --- very urgent .. help pleas (reddy)
    Re: parsing xml with perl --- very urgent .. help pleas (Tad McClellan)
    Re: parsing xml with perl --- very urgent .. help pleas <bongie@gmx.net>
    Re: parsing xml with perl --- very urgent .. help pleas (Jay Tilton)
        recording environment variables prior to download (Chris)
    Re: Regexps - multisymbol negation question (h\)
        removing duplicate values from array not working... (tony)
    Re: removing duplicate values from array not working... ctcgag@hotmail.com
    Re: simple file variable question <flavell@mail.cern.ch>
    Re: simple file variable question (Jay Tilton)
    Re: suggested revisions for the Posting Guidelines (Tad McClellan)
    Re: suggested revisions for the Posting Guidelines (Tad McClellan)
    Re: These are discouraging stats to Perlistas & Pythoni <krahnj@acm.org>
        word lenght (R.Noory)
    Re: word lenght (h\)
    Re: word lenght (Jay Tilton)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 10 Jan 2003 11:21:08 -0800
From: vanikandoori@yahoo.com (reddy)
Subject: Re: parsing xml with perl --- very urgent .. help please
Message-Id: <6cd469c.0301101121.5da8c47e@posting.google.com>

tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnb1sgi3.qvp.tadmc@magna.augustmail.com>...
> reddy <vanikandoori@yahoo.com> wrote:
> 
> > iam trying to parse a xml file. But the data between the tags does not
> > come up completely .
> 
> 
> > and the file look like this
> ><info>
> ><firstname>xyz</firstname>
> ><lastname>pppp</lastname>
> ><occupation>lkllklk</occupation>
> ><address>1234 dexon street
> > apt no :3333
> > sunnyvale, ca -95051</address>
> ></info>
> 
> 
> > now iam paring to get the content between the tags.The last tag which
> > has multiple lines does not show up properly .. mean iam geting only
> > the first line.. other lines r missing
> 
> 
> 
> > the code is:
> 
> 
> What on earth are you doing in this code?
> 
> 
> >     open (FILE,">$filename") || "Can't creat $filename; $!";
> 
> 
> What is that open() for?
> 
> You never use the FILE filehandle.
> 
> 
> >     # initialize the parser
> >     my $parser = XML::Parser->new( Handlers => 
> 
> 
> 
> There is almost always a better way than using XML::Parser nowadays.
> 
> With data as simple as yours, there is a much much better way...
> 
> 
> >     {                          
> >     Char  => \&char_handler      });
> >     $parser->parsefile($filename);
> >     my @data_stack;
> >     sub char_handler
> >      { 
> >      	 my ($p, $data) = @_;
> >          #$data =~ s/\n|\t//g;
> >          push(@data_stack, { data=>$data });
> >       
> >      }
> 
> 
> If you have a look at the contents of the data structure that
> you've built at this point, you'll see that everything you
> need is in there somewhere:
> 
>    use Data::Dumper;
>    print Dumper(\@data_stack), "\n";
> 
> Just write code to get it out.
> 
> 
> >      my @stackdata;
> >      foreach my $d (@data_stack)
> >      {
> >     	push(@stackdata,"$$d{ data }");
> >      }
> >      my $k=0;
> >      my @stackdata1;
> >      for(my $i=0;$i<@stackdata;$i++) {
> >         #$stackdata[$i]=~ s/\n|\t//g;
> >         #chomp $stackdata[$i];
> >         #$stackdata[$i] =~ tr/\n\t//d;
> >         if(length($stackdata[$i]) > 1 ){
> >         push(@stackdata1,"$stackdata[$i]");
> >         $k++;
> >         }
> >      }
> 
> 
> I have no idea what that code is supposed to be doing.
> 
> I think you wrote one loop to make hash refs, and another
> loop to dereference them.
> 
> What for? Why not just save the string data straightaway?
> 
> 
> >      my $fname = $stackdata1[0];
> >      my $lname = $stackdata1[1];
> >      my $ocp = $stackdata1[2];
> >      my $add = $stackdata1[3];
> > when i print the $add i get only the first line. 
> 
> 
> The other lines are in $stackdata1[4], $stackdata1[5]...
> 
> 
> > i want to the output as i entered
> > with the new line etc.like
> > when i print $add it should be like this
> > 1234 dexon street
> > apt no :3333
> > sunnyvale, ca -95051.
> 
> 
> You cannot use XML::Parser like that.
> 
> There may be _many_ calls to char_handler() while inside
> the _same_ element.
> 
> In the ridiculous extreme, it would be perfectly legal for
> XML::Parser to call the char_handler() with one character
> at a time.
> 
> You should stick the chars in a buffer in char_handler(),
> and then get the chars out of the buffer when you encounter
> the end tag for the containing element.
> 
> -------------------------------
> #!/usr/bin/perl
> use strict;
> use warnings;
> use XML::Parser;
> 
> my $xml = '<info>
> <firstname>xyz</firstname>
> <lastname>pppp</lastname>
> <occupation>lkllklk</occupation>
> <address>1234 dexon street
> apt no :3333
> sunnyvale, ca -95051</address>
> </info>
> ';
> 
> my $parser = XML::Parser->new( Handlers => { Char => \&char_handler,
>                                              Start  => \&start_handler,
>                                              End  => \&end_handler,
>                                            });
> my %data;
> $parser->parse($xml);
> my $add = $data{address};
> print "($add)\n";
> 
> my $chars;
> sub char_handler { $chars .= $_[1] }
> sub start_handler { $chars = '' }
> 
> sub end_handler {
>    $data{$_[1]} = $chars;
>    $chars = '';
> }
> -------------------------------
> 
> 
> But why do in 15 lines what can be done in 3 lines?
> 
> 
> -------------------------------
> #!/usr/bin/perl
> use strict;
> use warnings;
> use XML::Simple;
> 
> my $xml = '<info>
> <firstname>xyz</firstname>
> <lastname>pppp</lastname>
> <occupation>lkllklk</occupation>
> <address>1234 dexon street
> apt no :3333
> sunnyvale, ca -95051</address>
> </info>
> ';
> 
> my $ref = XMLin( $xml );
> my $add = $ref->{address};
> print "($add)\n";
> -------------------------------

Ur examples r very useful and efficient. But as i said my xml file
comes from an email. mean its the body of an email message.
@{$mail->body} has the whole xml file.
I have to add the start and end tags and then parse it. rite.
how do i add that. As in ur example u added the whole xml file to
$xml. But how do i add @{$mail->body} to $xml.
Iam getting errors.
 I tried passing the xml file that i created from the email body .like
$parser->parse($file);
my $ref = XMLin( $file);
still it does not work for me. It would be great if u could help me
further in this. I am rather new to perl and very confused as to how
to use all the methods and modulues.
Thanks


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

Date: Fri, 10 Jan 2003 15:17:51 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: parsing xml with perl --- very urgent .. help please
Message-Id: <slrnb1ue3v.t13.tadmc@magna.augustmail.com>

[ Learn how to quote properly, or be ignored.

  Do not send stealth Cc's.

  Do not use cutsie spelling.
]


reddy <vanikandoori@yahoo.com> wrote:
> tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnb1sgi3.qvp.tadmc@magna.augustmail.com>...
>> reddy <vanikandoori@yahoo.com> wrote:
>> 
>> > iam trying to parse a xml file. But the data between the tags does not
>> > come up completely .

[ snip over 100 lines not need to establish context ]

>> -------------------------------
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> use XML::Simple;
>> 
>> my $xml = '<info>
>> <firstname>xyz</firstname>
>> <lastname>pppp</lastname>
>> <occupation>lkllklk</occupation>
>> <address>1234 dexon street
>> apt no :3333
>> sunnyvale, ca -95051</address>
>> </info>
>> ';
>> 
>> my $ref = XMLin( $xml );
>> my $add = $ref->{address};
>> print "($add)\n";
>> -------------------------------
> 
> Ur examples r 


Please use real English.


> very useful and efficient. But as i said my xml file
> comes from an email. mean its the body of an email message.


Yes, I understood that.


> @{$mail->body} has the whole xml file.


I don't recall you showing us what $mail was, we are not mind readers.


> I have to add the start and end tags and then parse it. rite.
> how do i add that. As in ur example u added the whole xml file to
> $xml. But how do i add @{$mail->body} to $xml.


   my $xml = '<something>' . join('', @{$mail->body}), '</something>';

> Iam getting errors.


We cannot help you fix your code if you do not show it to us.


>  I tried passing the xml file that i created from the email body .like
> $parser->parse($file);
> my $ref = XMLin( $file);
> still it does not work for me. 
           ^^^^^^^^^^^^^

What does "does not work" mean when you say it?

Did you get any messages?

Did it make too much output?

Did it make too little output?

Did it make incorrect output?

Did it just sit there and do nothing?

Did it get stuck in an infinite loop?

Did smoke come out of the computer's vents?


> It would be great if u could help me
> further in this.


Knowing what the symptoms are is a great aid in providing a diagnosis...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 10 Jan 2003 22:58:46 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: parsing xml with perl --- very urgent .. help please
Message-Id: <3086196.5ClqfdXBjP@nyoga.dubu.de>

Tad McClellan wrote:
>    my $xml = '<something>' . join('', @{$mail->body}), '</something>';
                                                       ^ .

> Did smoke come out of the computer's vents?

Had that some weeks ago, but I was not using Perl at that moment. ;-)

Ciao,
        Harald [now with new motherboard, CPU, RAM, and case]
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I stayed up all last night playing poker with tarot cards. 
I got a full house and four people died.        -- Stephen Wright



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

Date: Fri, 10 Jan 2003 22:51:15 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: parsing xml with perl --- very urgent .. help please
Message-Id: <3e1f4959.70199034@news.erols.com>

vanikandoori@yahoo.com (reddy) wrote:

: tadmc@augustmail.com (Tad McClellan) wrote 
: > reddy <vanikandoori@yahoo.com> wrote:
: > 
: > > iam trying to parse a xml file. But the data between the tags does not
: > > come up completely .
: > > and the file look like this
: > ><info>
: > ><firstname>xyz</firstname>
: > ><lastname>pppp</lastname>
: > ><occupation>lkllklk</occupation>
: > ><address>1234 dexon street
: > > apt no :3333
: > > sunnyvale, ca -95051</address>
: > ></info>

: > -------------------------------
: > #!/usr/bin/perl
: > use strict;
: > use warnings;
: > use XML::Simple;
: > 
: > my $xml = '<info>
: > <firstname>xyz</firstname>
: > <lastname>pppp</lastname>
: > <occupation>lkllklk</occupation>
: > <address>1234 dexon street
: > apt no :3333
: > sunnyvale, ca -95051</address>
: > </info>
: > ';
: > 
: > my $ref = XMLin( $xml );
: > my $add = $ref->{address};
: > print "($add)\n";
: > -------------------------------
: 
: Ur examples r very useful and efficient. 

Please, no leetspeek.  clpm readers are tragically unhip, in that they
still place high value on clarity of thought and expression.

: @{$mail->body} has the whole xml file.
: I have to add the start and end tags and then parse it. rite.
: how do i add that. As in ur example u added the whole xml file to
: $xml. But how do i add @{$mail->body} to $xml.

What have you tried?

: Iam getting errors.

What are the errors?

Not only is this information crucial for proper debugging, but
studying the mistakes may help prevent confusion next time.

Anyway, double-quotish interpolation is an easy way to make a single
string from the contents of an array.

    my $xml = "<info>@{$mail->body}</info>";

but that introduces spaces between the stringified array elements
(see $" in perlvar).  A simple join() might be preferred.

    my $xml = join '', '<info>', @{$mail->body}, '</info>';

:  I tried passing the xml file that i created from the email body

"the xml file" could mean a lot of things.  What exactly is in the
scalar $file?  A filename?  A filehandle?  The stringified contents of
a file?

: $parser->parse($file);
: my $ref = XMLin( $file);

The first line suggests you're still trying to get the old XML::Parser
code to work, but the second line suggests you've switched to
XML::Simple.  Which is it?

: still it does not work for me.

"Does not work" is a content-free phrase, and does nothing to describe
the problem.  That's especially frustrating when "it" is so vaguely
described.

What changes did you make to the program?
What should the program do that it does not?
What does the program do that it should not?

In future, please trim reply-quoted material to the minimum necessary
to establish context for you comments.  Including all of Tad's post,
thorough as it was, was overkill.



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

Date: 10 Jan 2003 13:40:17 -0800
From: chris_12003@yahoo.com (Chris)
Subject: recording environment variables prior to download
Message-Id: <7f746dd.0301101340.3ff53fea@posting.google.com>

I'm trying to give my users a single url address to download a
specific file.  Since this is a password protected folder I'd like to
record the remote_user and some other environment variables. 
Something like:

http://www.mysite.com/getfile.pl?file1.exe

Where getfile.pl would write to a text file the remote_user,
data_local and then allow the user to download the file.

Thanks for any help you can provide?
Chris


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

Date: Fri, 10 Jan 2003 20:48:06 +0100
From: "Michael Peuser \(h\)" <post@mpeuser.de>
Subject: Re: Regexps - multisymbol negation question
Message-Id: <avn7vn$34o$04$1@news.t-online.com>


"Brian McCauley" <nobull@mail.com> schrieb im Newsbeitrag
news:u9vg0wlwxf.fsf@wcl-l.bham.ac.uk...
> jgenyuk@ucar.edu (Julia Genyuk) writes:
>
> > I need to find and remove all rows in an HTML table which include a
> > given string,
> > <tr> (anything but not <tr> or </tr> ) $given_string (anything but not
> > <tr> or </tr>) </tr>
> > Is there any reasonably easy way of doing this?
>
> Something like the following possible but I wouldn't reommend it:
>
>   s/(<tr>.*?<\/tr>)/index($1,$given_string) < 0 ? $1 : ''/egs;
>

I think this a a quite adaquate solution, valid for a lot of similar
situation where no HTML is involved.
There is a minor flaw in it, however: it will not work with $given_string
='tr' etc.
Thow this is trivial to compensate for:

   s/(<tr>.*?<\/tr>)/index(substr($1,5, length($1)-9),$given_string) < 0 ?
$1 : ''/egs;

it has become a little bit awkward now.....

Kindly
Mike






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

Date: 10 Jan 2003 11:33:10 -0800
From: yello62@yahoo.com (tony)
Subject: removing duplicate values from array not working...
Message-Id: <34175232.0301101133.1cfeed9f@posting.google.com>

below is the code i am using.  i am putting a process together that
will be working on files of varying sizes.  the files will contain 36
delimited columns and anywhere from 5000 rows on up.  the code piece i
am presenting is not the entire code, just an element of it.  i am
trying to extract unique elements from the file.  i am using the
fourth element as my value (it is twelve characters in length all
numeric.  think social security numbers with padding).  i'm pushing
the fourth element of every row onto a temporary array.

my expectation was that by applying any of the routines mentioned in
the faq(4) or the cookbook would leave me with a resultant array with
unique values.

using a foreach loop to print each element of the resultant array
leaves me with all of the values from my original array, albeit the
fourth element.  i have tried every one of the solutions presented in
the faq(4) and one of the solutions in the cookbook and i continue to
get duplicates.  i am at a loss and am appealing to the masses for
direction.  am i missing something that is so obvious as to be
invisible to someone who has spent too many days trying to figure out
why?  any and all help would be greatly appreciated.

_______________________________________________________________________________

while (<>) {
	push @tmp,[split/;/];
}

foreach $row (@tmp) {
	push @tmpTwo,[@$row[4]];
}

undef %saw;

@out = grep(!$saw{$_}++, @tmpTwo);

# i'm only using this to see what values are stored in the array.  
# the final process will use the values in the 
# array as a match against another array to extract individual
elements.

foreach $row (@out) { 	
         print "@$row\n";  
}

_______________________________________________________________________________

thank you in advance.


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

Date: 10 Jan 2003 20:26:20 GMT
From: ctcgag@hotmail.com
Subject: Re: removing duplicate values from array not working...
Message-Id: <20030110152620.046$R7@newsreader.com>

yello62@yahoo.com (tony) wrote:
>
> while (<>) {
>         push @tmp,[split/;/];
> }
>
> foreach $row (@tmp) {
>         push @tmpTwo,[@$row[4]];
> }

You are pushing a brand new reference to an array containing a single
element into another array.  There's no reason to do that, push what you
want, not a reference to a single-member array containing what you want.

>
> undef %saw;
>
> @out = grep(!$saw{$_}++, @tmpTwo);

You are finding all the arrayrefs that stringify to unique strings, i.e.
all of them.  The references themselves are all unique, even if they
contain values that are equivalent.

You also appear to not be using strict.  Shame on you.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: Fri, 10 Jan 2003 20:34:07 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: simple file variable question
Message-Id: <Pine.LNX.4.40.0301102012410.13052-100000@lxplus076.cern.ch>

On Jan 10, Walter Mitty inscribed on the eternal scroll:

> To all: it is often the case that the computer language HIDES the OS
> specifics of file paths,

IME that's rare, not "often".  Anyway, your later examples contradict
your claim,

> OS kernel calls etc.

Your question wasn't about OS kernel calls.  You rate to solve your
own problems faster when you gain an appropriate mental model of your
problem domain - and then seeking the answer in the appropriate place
- instead of dragging-in irrelevant detail.

> An example would be escaping backslashes in the C programming language

I don't agree.  Escaping backslashes in C in particular contexts is
applicable to any string of characters in those contexts, it doesn't
have any specific relevance to file paths. It certainly doesn't
qualify as "HIDES the OS specifics of file paths" in any sense that I
could understand.

> My question was simple :

Actually your question was fairly confused, mixing up issues of CGI
script functionality, appropriate configuration of materials for a web
server - most of which would have been appropriate on the relevant
comp.infosystems.www.* group(s), and would have been much the same if
you had been programming your script in C or FORTRAN, whatever, and
thus had nothing to do with Perl as such.

The answers you got could have been genuinely helpful to someone who
wanted to be helped, even if they came out somewhat jaded after the
procession of thousands who have been similarly confused about their
problem domain. You abusively rejected the help.  You appear to have
won a number of killfile entries from the more helpful contributors
around here.  Well done (and so you ought to be).

bye.



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

Date: Fri, 10 Jan 2003 22:57:53 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: simple file variable question
Message-Id: <3e1f4f76.71763884@news.erols.com>

"Walter Mitty" <shamrockirishbar.remove.nospam@yahoo.co.uk> wrote:

: To all

I certainly hope so.  Usenet is a poor choice for private
communication.

: it is often the case that the computer language HIDES the OS
: specifics of file paths, OS kernel calls etc.
:
: An example would be escaping backslashes in the C programming language 
: yet not having to do so in Basic or perhaps Java (I don't know).

You're confusing problem domains again.

That's an example of a language's syntax.  Specifically, the syntax
for representing a string in code.  Whether backslashes need to be
backslash-escaped has nothing to do with the string being a filename.

And the backslashes would have to be changed to something else if the
program was migrated to a non-MS platform.  Instead of showing how a
programmer may be insulated from filesystem-specific details, you have
shown how the programmer is exposed to them.

: I certainly didn't ask for a pedantic prick to remind me multiple times that
: it wasn't perl.

*shrug*

Ignoring a person you find bothersome may be better than launching a
feeble attack.

A "YHBT" could be justified.



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

Date: Fri, 10 Jan 2003 13:15:08 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: suggested revisions for the Posting Guidelines
Message-Id: <slrnb1u6ts.sh4.tadmc@magna.augustmail.com>

Brian McCauley <nobull@mail.com> wrote:
> tadmc@augustmail.com (Tad McClellan) writes:
> 
>> So I will be revising the Posting Guidelines shortly.
>> 
>> Anybody have a burning desire to add/delete/change anything
>> else while I am in there?


> Could, without significant loss of information, be reduced to:
> 
>     Lurk for a while before posting
> 
>         This is very important and expected in all newsgroups.
>         Lurking means to monitor a newsgroup for a period to become
>         familiar with local customs. Each newsgroup has specific
>         customs and rituals.  Knowing these before you participate
>         will help avoid embarrassing social situations.  Consider
>         yourself to be a foreigner at first!


Done.


> Do you (by which I mean the nettizens as of clp* as a whole, not just
> Tad) want me to go though the whole document to find other stuff like
> this or do people prefer the more wordy style?


I'd like that. I prefer terseness.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 10 Jan 2003 13:19:30 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: suggested revisions for the Posting Guidelines
Message-Id: <slrnb1u762.sh4.tadmc@magna.augustmail.com>

Alan J. Flavell <flavell@mail.cern.ch> wrote:
> On Jan 10, Tad McClellan inscribed on the eternal scroll:
> 
>> Anybody have a burning desire to add/delete/change anything
>> else while I am in there?

> new:
> 
>  Intersperse your comments I<following> each section of quoted text
>  to which they relate.  Defective followup styles are referred to as
>  "Jeopardy" (because the answer comes before the question), or "TOFU".


Done.

Except I used "Unappreciated" instead of "Defective".

I _can_ be PC (no, not that PC, the other PC) from time to time.


> The only other comment I have about this excellent document is
> that, yet again, a number of recent postings have emphasised the
> importance of the whole section:
> 
>  Question should be about Perl, not about the application area


> I wish I knew the answer, but I don't have anything terse enough and
> effective enough to go into the posting guidelines. 


Me either. I'll leave that part as-is.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 10 Jan 2003 20:03:42 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: These are discouraging stats to Perlistas & Pythonistas...
Message-Id: <3E1F2683.F67B1811@acm.org>

Paul Boddie wrote:
> 
> jacob@cd.chalmers.se (Jacob Hallen) wrote in message news:<avfkpp$a7n$1@nyheter.chalmers.se>...
> >
> > An interesting thought is wether the 55 Python programmers will produce
> > more useful applications than the 2037 VB programmers.
> 
> It gets even more interesting if you take monkeys and typewriters into
> consideration.

I thought VB implied monkeys and typewriters?


John
-- 
use Perl;
program
fulfillment


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

Date: 10 Jan 2003 11:26:31 -0800
From: rnoory@videotron.ca (R.Noory)
Subject: word lenght
Message-Id: <8fec9af1.0301101126.14341be6@posting.google.com>

Hello, 

Applying this pattern ['\S(\w{5})'] gives me words with six letters and more. 
['\S(\w{1,5})']doesn't seem to work. So please help me with these expressions. 

1. 6 letters and more. 
2. more or equal to six letters
3. equal to 6 letters
4. less than 6 letters
5. less or equal to 6 letters

Thanks


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

Date: Fri, 10 Jan 2003 22:50:29 +0100
From: "Michael Peuser \(h\)" <post@mpeuser.de>
Subject: Re: word lenght
Message-Id: <avnf59$7k6$00$1@news.t-online.com>


"R.Noory" <rnoory@videotron.ca> schrieb im Newsbeitrag
news:8fec9af1.0301101126.14341be6@posting.google.com...
> Hello,
>
> Applying this pattern ['\S(\w{5})'] gives me words with six letters and
more.
> ['\S(\w{1,5})']doesn't seem to work. So please help me with these
expressions.
>
> 1. 6 letters and more.
> 2. more or equal to six letters
> 3. equal to 6 letters
> 4. less than 6 letters
> 5. less or equal to 6 letters
>

A strongly recommend you read perlre! Are you aware of the difference
between "letters" , "\w", and "\S" ?
Why do you think there is a difference between 1. and 2. above?

Kindly Mike




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

Date: Fri, 10 Jan 2003 22:28:23 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: word lenght
Message-Id: <3e1f4894.70002089@news.erols.com>

rnoory@videotron.ca (R.Noory) wrote:

: Applying this pattern ['\S(\w{5})'] gives me words with six letters and more.
                        ^^         ^^
                        ^^         ^^
What's with the extra punctuation?  How much of that is the actual
pattern?

Do you realize that the pattern matches a substring of only six
letters, and is not necessarily a complete word?  That the captured
portion will be only the trailing five of those letters?

Do you know what \S is?  Are you perhaps confusing it with \s?  Are
you trying to make the match begin at word boundaries?

The pattern is simply not doing what you think it is doing.  Please
show how you are testing your patterns.  There are clearly some things
your test is overlooking.

: ['\S(\w{1,5})']doesn't seem to work.

What did you expect to happen if it did seem to work?
How is that expectation different from reality?

: So please help me with these expressions. 
: 
: 1. 6 letters and more. 
: 2. more or equal to six letters

Those two are different from each other, and what you already have, in
what ways?

: 3. equal to 6 letters
: 4. less than 6 letters

See the response to the article you posted two weeks ago, with the
same typo in the subject line.

: 5. less or equal to 6 letters

    m/\b\w{1,6}\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 4381
***************************************


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