[19842] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2037 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 30 14:06:31 2001

Date: Tue, 30 Oct 2001 11:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1004468708-v10-i2037@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 30 Oct 2001     Volume: 10 Number: 2037

Today's topics:
    Re: CGI param/regex difficulties <bert@scanlaser.nl>
    Re: challenge, how short can you make this? <uri@stemsystems.com>
    Re: challenge, how short can you make this? <dperham@dperham.eng.tvol.net>
    Re: Control M's still there? - how to make sure? <djberg96@hotmail.com>
    Re: File handle leak- how bad? <bart.lateur@skynet.be>
    Re: FTP,Mail Modules for ActivePerl (Al Binns)
        I am looking for several perl programs for my course bu (pete pack)
    Re: I am looking for several perl programs for my cours <echang@netstorm.net>
    Re: I am looking for several perl programs for my cours <spam@thecouch.homeip.net>
    Re: I am looking for several perl programs for my cours <jurgenex@hotmail.com>
    Re: I am looking for several perl programs for my cours <tsee@gmx.net>
    Re: keyname glob? nobull@mail.com
        ms-word doc's & perl <peter_icaza@REMOVE2REPLYuhc.com>
    Re: ms-word doc's & perl (Malcolm Dew-Jones)
    Re: ms-word doc's & perl <camerond@mail.uca.edu>
    Re: perlish way to read/write absolute sectors from PC  <simon.oliver@umist.ac.uk>
    Re: perlsub (Tad McClellan)
    Re: print out the difference between two arrays <djberg96@hotmail.com>
    Re: Private instance variables in Objects ?? nobull@mail.com
        regexp simple question <achatz@forthnet.gr>
    Re: regexp simple question <bernard.el-hagin@lido-tech.net>
    Re: regexp simple question <achatz@forthnet.gr>
    Re: regexp simple question (Tad McClellan)
    Re: regexp simple question <peterd@physik.uni-augsburg.de>
        Useless use of private hash in void context (Mike Wangu)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 30 Oct 2001 17:00:58 +0100
From: Bert IJff <bert@scanlaser.nl>
Subject: Re: CGI param/regex difficulties
Message-Id: <3BDECEBA.9D73B97@scanlaser.nl>



Simon Oliver wrote:

> And please correct me if I'm wrong but which OS uses \012\015? As far as
> I know:
> 
> Unix  = \015
> Win32 = \015\012
> Mac   = \012
> 
Wrong ;-)
Unix  = \012
Win32 = \015\012
Mac   = \015


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

Date: Tue, 30 Oct 2001 18:38:24 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: challenge, how short can you make this?
Message-Id: <x78zdtx99s.fsf@home.sysarch.com>

>>>>> "m" == mc  <invalid@mctech.org> writes:

  m> Mona Wuerz wrote:
  >> 
  >> mc <invalid@mctech.org> writes:
  >> 
  >> > input:  $_ = "34 - 39 , 41 , 44";
  >> >
  >> > output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
  >> 
  >> perl -wle '$_="34 - 39 , 41 , 44"; s/-/../; @x=eval; print "@x"'
  >> 
  >> -mona

  m> And lest mona feel left out; She(?) has the same code as Tad,
  m> posted 3 hours earlier. I just saw Tad's first. Congradulations to
  m> both of you.

just be aware that in perl golf, anything goes including string
eval. but in real world code, string eval is a last resort and can be
very dangerous. perl golf is fun and can be educational but never try to
emulate golf style in real code.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: 30 Oct 2001 14:01:10 -0500
From: Doug Perham <dperham@dperham.eng.tvol.net>
Subject: Re: challenge, how short can you make this?
Message-Id: <811yjl3qbt.fsf@wgate.com>

mc <invalid@mctech.org> writes:

> Here's a challenge for those who like to boil scripts down to their
> lowest common denominator so to speak ....
> 
> A script [segment] to do the following ...
> 
> input:  $_ = "34 - 39 , 41 , 44";
> 
> output: (34, 35, 36, 37, 38, 39, 41, 44) # as array
> 

What the heck -  

perl -pe 's/-/../g; $_=join(", ",eval $_);'



[...]

> formatting whitespace does not count toward length.
> 
> how small can ya make it?
> 

[...]


-- 
Doug Perham                                          o{..}o     
dperham@wgate.com                                moo! (oo)___   
WorldGate Communications, Inc.                        (______)\ 
                                                      / \  / \  


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

Date: Tue, 30 Oct 2001 16:03:22 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: Control M's still there? - how to make sure?
Message-Id: <ebAD7.21423$CN5.1476502@typhoon.mn.mediaone.net>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9ts65l.ras.tadmc@tadmc26.august.net...
> Dan West <danno966@hotmail.com> wrote:
>
> >you know vi, you can use /s/<ctl>v<ctl>m// at the command line to remove
the
> >offending bits.....
>
>
> And if you know Perl, you can use
>
>    perl -p -i -e 'tr/\r//d' file1 file2 ...
>
> to remove the Carriage Return characters (aka: control-Ms).
>
>
> Giving a vi solution in a Perl newsgroup just doesn't seem "right"  :-)

even easier (if it's installed)....

dos2unix <filename>

Regards,

Mr. Sunblade




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

Date: Tue, 30 Oct 2001 15:30:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: File handle leak- how bad?
Message-Id: <fqhtttg931862uphv22vt16cejppgqf05d@4ax.com>

Ilya Martynov wrote:

>            You don't have to close FILEHANDLE if you are immediately going
>            to do another "open" on it, because "open" will close it for
>            you. (See "open".)

An implicit close() also happens if the filehandle goes out of scope.

Unforunately the same thing doesn't happen with directories i.e.
opendir/closedir.

-- 
	Bart.


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

Date: 30 Oct 2001 06:25:44 -0800
From: al_binns@yahoo.com (Al Binns)
Subject: Re: FTP,Mail Modules for ActivePerl
Message-Id: <b3918c8b.0110300625.3f140b97@posting.google.com>

"Ferry Bolhar" <bol@adv.magwien.gv.at> wrote in message news:<1004441265.541345@mozart.adv.magwien.gv.at>...
> Hi to all,
> 
> I'm looking for modules like Mail::Mailer and Net::FTP, to use on NT4
> systems with Active Perl. Seems that these modules are not distributed with
> ActivePerl. I also looked at CPAN but didn't find them.
> 
> Can someone point in the right direction?
> 
> MTIA and kind greetings,
> 
> Ferry


perldoc ppm
or the html docs that come with activeperl

HTH


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

Date: 30 Oct 2001 08:25:20 -0800
From: mloan@yahoo.com (pete pack)
Subject: I am looking for several perl programs for my course but can't find them, please help me...
Message-Id: <9f8cf130.0110300825.6c8cb9e@posting.google.com>

First, I am not a programmer but need several things to finish an
online course that my students can use. I don't know where to find
these things and need help. Can you tell me where to find perl
programs or something similar that can help me finish my course up

Here it goes...

1.	I need a registration page for my students that stores their data
and keeps it in a special folder.

2.	I need a program that automatically sends my registered students a
password and gives them access to our course.

4.	I need a program that tracks my students through my course and when
they log on and off automatically takes them back to where they left
off.

5.	I need a program that automatically grades each of the seven course
quizzes and passes them on to the next section if they get all the
answers right. Also, if they miss questions, it will show them what
they missed and not let them pass to the next section.  ALSO, if they
don't pass the quiz, they will have to re-read the section and take a
different test until they pass.

6.	I need a program to administer a final exam and inform my students
of their score. If they pass, they need to be informed that they have
passed.

7.	I need each of my student's information to be stored in a folder
that has all of their information in it so that we can keep accurate
records of them.

Thank you for helping me...

Patrick


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

Date: Tue, 30 Oct 2001 17:30:54 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: I am looking for several perl programs for my course but can't find them, please help me...
Message-Id: <Xns914A804A4A2Dechangnetstormnet@207.106.92.86>

mloan@yahoo.com (pete pack) wrote in
news:9f8cf130.0110300825.6c8cb9e@posting.google.com: 

> First, I am not a programmer but need several things to finish an
> online course that my students can use. I don't know where to find
> these things and need help. Can you tell me where to find perl
> programs or something similar that can help me finish my course up
> 
> Here it goes...
> 

[Seven detailed, non-trivial requirements snipped]

It sounds like what you want is a complete online course management 
system.  If you're not a programmer you don't want to try to install 
and administer such a system yourself, so look for one that offers an 
online portal.  WebCT (written in Perl!) and Blackboard are the biggest 
names in the field.  

-- 
EBC


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

Date: Tue, 30 Oct 2001 12:31:19 -0500
From: "Mina Naguib" <spam@thecouch.homeip.net>
Subject: Re: I am looking for several perl programs for my course but can't find them, please help me...
Message-Id: <ztBD7.16358$NY2.995577@wagner.videotron.net>


"pete pack" <mloan@yahoo.com> wrote in message
news:9f8cf130.0110300825.6c8cb9e@posting.google.com...
> First, I am not a programmer but need several things to finish an
> online course that my students can use. I don't know where to find
> these things and need help. Can you tell me where to find perl
> programs or something similar that can help me finish my course up
>
> Here it goes...
>
> 1. I need a registration page for my students that stores their data
> and keeps it in a special folder.
>
> 2. I need a program that automatically sends my registered students a
> password and gives them access to our course.
>
> 4. I need a program that tracks my students through my course and when
> they log on and off automatically takes them back to where they left
> off.
>
> 5. I need a program that automatically grades each of the seven course
> quizzes and passes them on to the next section if they get all the
> answers right. Also, if they miss questions, it will show them what
> they missed and not let them pass to the next section.  ALSO, if they
> don't pass the quiz, they will have to re-read the section and take a
> different test until they pass.
>
> 6. I need a program to administer a final exam and inform my students
> of their score. If they pass, they need to be informed that they have
> passed.
>
> 7. I need each of my student's information to be stored in a folder
> that has all of their information in it so that we can keep accurate
> records of them.

Embrace yourself for possible flaming from others, although I'll be lenient.

*Generally* speaking,  the *.perl.* newsgroups are technical forums. They
are for programmers to ask other programmers for help with very specific
technical pieces of code, logic flow for their programs, etc..

Therefore, your post does not fit in here.

Your requests are VERY detailed which makes me doubt you will be able to
immediately find an already-written code that will do the jobs you
requested. However, I will assume you have already done your homework and
diligently searched the net for a few days before asking here.

Let me assure you that perl would be a perfect language to do what you've
requested.

That said, let me suggest that you either 1. Learn perl and get it done or
2. Hire a perl programmer. http://jobs.perl.org is a nice place to start.

>
> Thank you for helping me...
>
> Patrick




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

Date: Tue, 30 Oct 2001 09:33:47 -0800
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: I am looking for several perl programs for my course but can't find them, please help me...
Message-Id: <3bdee486$1@news.microsoft.com>

"pete pack" <mloan@yahoo.com> wrote in message
news:9f8cf130.0110300825.6c8cb9e@posting.google.com...
> First, I am not a programmer but need several things to finish an
> online course that my students can use. I don't know where to find
> these things and need help. Can you tell me where to find perl
> programs or something similar that can help me finish my course up
>
[long list of requirements snipped]

You are looking at the wrong place.
First of all none of your questions/issues is Perl specific. Your solution
could be implemented in any programming language whatsoever.
And second you are not looking for help with a specific issue but what you
need is a programmer or a full-service ISP which may even create and
administer this site for you (for a hefty fee of course).
In any case if you are looking for a programmer then jobs.offered would be a
better place to ask and if you are looking for a CGI solution then you will
be way better of asking in e.g. webauthoring.cgi or a related group.

jue




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

Date: Tue, 30 Oct 2001 19:40:50 +0100
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: I am looking for several perl programs for my course but can't find them, please help me...
Message-Id: <9rms95$sqg$07$1@news.t-online.com>

"Mina Naguib" <spam@thecouch.homeip.net> schrieb im Newsbeitrag
news:ztBD7.16358$NY2.995577@wagner.videotron.net...

[snip]

| That said, let me suggest that you either 1. Learn perl and get it done or
| 2. Hire a perl programmer. http://jobs.perl.org is a nice place to start.

Let me add: This (clpm) is not the place to start. No flaming intended
whatsoever.

| > Thank you for helping me...

Sorry that I cannot.

Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;print"\n";$o=$_;push@o,substr($o,$_*8,
8)for(0..24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\n";$i++}#st_m





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

Date: 30 Oct 2001 17:48:44 +0000
From: nobull@mail.com
Subject: Re: keyname glob?
Message-Id: <u9y9lt3toj.fsf@wcl-l.bham.ac.uk>

asmith6@nc.rr.com (aaron smith) writes:

> > What is a "keyname glob"?  Don't expect people to understand technical
> > terms you just made up for the nonce.
> 
> keyname = name of a key of a hash
> glob = splat (*)
> 
> can i use a keyname glob in perl?

Don't expect people to understand technical terms you just made up for
the nonce.

Sure you can use an asterisk as a hash key but it has no special
semantics.

If you want a hash that does wildcard matching you'll need to make
one.  Actually I think you can get one from CPAN - but it may not use
the wildcard rules you want.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 30 Oct 2001 09:19:05 -0500
From: peter <peter_icaza@REMOVE2REPLYuhc.com>
Subject: ms-word doc's & perl
Message-Id: <3BDEB6D9.3D0A975@REMOVE2REPLYuhc.com>

hi,
i am required to create very verbose m$-word doc's for the project i am
on.  these doc's are created from a m$-word template and alot of the
work necesary is repeatative and tedious.  if they were UNIX doc's, i
could set something up to search/substitute keywords with the specific
phrases needed.

i looked at the m$-word doc's w/ vim and there is virtually no way, i
can see,  to decode them into "key words" as i would like.

any suggestions?

tia,
peter




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

Date: 30 Oct 2001 08:58:44 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: ms-word doc's & perl
Message-Id: <3bdedc44@news.victoria.tc.ca>

peter (peter_icaza@REMOVE2REPLYuhc.com) wrote:
: hi,
: i am required to create very verbose m$-word doc's for the project i am
: on.  these doc's are created from a m$-word template and alot of the
: work necesary is repeatative and tedious.  if they were UNIX doc's, i
: could set something up to search/substitute keywords with the specific
: phrases needed.

: i looked at the m$-word doc's w/ vim and there is virtually no way, i
: can see,  to decode them into "key words" as i would like.

: any suggestions?


Convert the docs to rtf format, and then you can massage them easily with
perl.

Though not perl, it might be easy to write some VB macros within msword to
automate the steps involved in preparing the document. 



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

Date: Tue, 30 Oct 2001 12:24:16 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: ms-word doc's & perl
Message-Id: <3BDEF050.E289EA53@mail.uca.edu>

peter wrote:
> 
> hi,
> i am required to create very verbose m$-word doc's for the project i am
> on.  these doc's are created from a m$-word template and alot of the
> work necesary is repeatative and tedious.  if they were UNIX doc's, i
> could set something up to search/substitute keywords with the specific
> phrases needed.
> 
> i looked at the m$-word doc's w/ vim and there is virtually no way, i
> can see,  to decode them into "key words" as i would like.

Figure out what you want to automate, record a macro in Word (WARNING:
VB here), then translate it into Perl using Win32::OLE to run M$Word.
It's not all that hard, particularly if you just want to insert
words/phrases at specific points from a database or other text file.

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Tue, 30 Oct 2001 14:10:08 +0000
From: Simon Oliver <simon.oliver@umist.ac.uk>
Subject: Re: perlish way to read/write absolute sectors from PC disk?
Message-Id: <3BDEB4C0.B2DD12A3@umist.ac.uk>

Of course under Unix you can use `dd` to do this, something like this:

dd if=/dev/hda of=/bootsect bs=512 count=1

Under DOS you can use `debug` but don't know about NT - I guess it would
complain if you try to write to a raw device.  Here are a few
possibilities but I think you will run into the same problem.

The NT Resource kit includes DISKSAVE.EXE which enables a binary image
of the MBR or Boot Sector to be saved. See...

http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=13754

Also there's a utility called mbredit that might do the job...

http://www.kzin.com/bootsec/
http://www.kzin.com/utillc/bin/mbredit.exe

--
  Simon Oliver


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

Date: Tue, 30 Oct 2001 15:03:09 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perlsub
Message-Id: <slrn9ttdeq.t6s.tadmc@tadmc26.august.net>

Just in <justin.devanandan.allegakoen@intel.com> wrote:

>Suppose I had a program that has a variable 
                                  ^^^^^^^^^^

Perl has two kinds of variables, lexical (my) and dynamic
(our, use vars). You need the dynamic kind for this sort
of thing.


>in a subroutine that
>I call from other programs by means of require.


It might be "better" to make it a module and use "use" instead
of "require".


>Good Perl programming etiquette dictates that I should use strict,
>and use warnings - so apart from not using them, just
>how exactly am I supposed to use a variable from a sub that I required
>from another program, without STDERR crying foul?
>
>I read as far as I could with perlsub, but I sort of lost it 


Try these man pages also:     perlmod.pod   perlmodlib.pod

   perldoc -q require


>. . . Mr
>Dominus' perlreftut
>was helpful though . . . 


See also his "Coping with Scoping":

   http://perl.plover.com/FAQs/Namespaces.html


>then again I can't see how it fits in 


You do not need referencs for what you are attempting to do.

We would be able to give more direct help if you posted a short
and complete program that illustrates what you need done...


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


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

Date: Tue, 30 Oct 2001 15:59:02 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: print out the difference between two arrays
Message-Id: <a7AD7.21422$CN5.1476810@typhoon.mn.mediaone.net>


"Tim" <tvn007@hotmail.com> wrote in message
news:21724be2.0110292239.5f787fe9@posting.google.com...
> Hi,
>
> Here is my script:
>
> #!/usr/local/bin/perl -w
>
> # Purpose:
> # This script determines if two arrays are the same.
>
> # Create the arrays.
> my @array1 = qw (0001 1234 2337);
> my @array2 = qw (0001 1234 2337 7777);
>
> # Check if the same elements are contained in the two arrays.
> my $arrayString1 = join (' ', sort @array1);
> my $arrayString2 = join (' ', sort @array2);
> if ($arrayString1 eq $arrayString2)
> {
>     print "Check 1: The arrays contain the same elements.\n";
> }
> else
> {
>     print "Check 1: The arrays do not contain the same elements.\n";
> }
>
> ##############################################
> is it possible to have the script print out the difference between
> @array1 and @array2 ? In this case, it should print
> "@array2 has 7777"
>
> Could someone please help me on this ?
>
> Thanks in advance for your time

Tim,

Also take a look at either Set::Array or Set::Scalar for modules that
perform set operations on arrays.

e.g.
$set1 = Set::Array->new(qw (0001 1234 2337));
$set2 = Set::Array->new(qw (0001 1234 2337 7777));

$set1->difference($set2)->print(1);

Regards,

Mr. Sunblade







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

Date: 30 Oct 2001 17:39:13 +0000
From: nobull@mail.com
Subject: Re: Private instance variables in Objects ??
Message-Id: <u91yjl58ou.fsf@wcl-l.bham.ac.uk>

realnewbie2000@yahoo.com (Real Newbie) writes:

> Is there a way to create private variables in Perl Objects?

No there's no concept of privacy in Perl5.  That's not _exactly_ true
but since you brand youself "Real Newbie" you really don't want to
know about the advanced tricks like using objects based on blessed
closures.
 
-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 30 Oct 2001 16:23:07 +0200
From: Tassos Chatzithomaoglou <achatz@forthnet.gr>
Subject: regexp simple question
Message-Id: <3BDEB7CB.4666AFD6@forthnet.gr>

What is the regexp i should if i want to do the following?

allow
-----
+12
-0
+235
-67842

deny
----
scv
+fdgb
+34f+ert
-56gf
+45 78

I have tried /^[+-]\d+?/ but it doesn't seem to work...


-- 
***************************
Chatzithomaoglou Anastasios
 Network Operations Center
       FORTHnet S.A.
   <achatz@forthnet.gr>
***************************


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

Date: Tue, 30 Oct 2001 14:40:11 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: regexp simple question
Message-Id: <slrn9ttegh.3nk.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 30 Oct 2001 16:23:07 +0200, Tassos Chatzithomaoglou
<achatz@forthnet.gr> wrote:
> What is the regexp i should if i want to do the following?
> 
> allow
> -----
> +12
> -0
> +235
> -67842
> 
> deny
> ----
> scv
> +fdgb
> +34f+ert
> -56gf
> +45 78
> 
> I have tried /^[+-]\d+?/ but it doesn't seem to work...


------------------
while (<DATA>){
  print if /^[+-]\d+$/;
}

__DATA__
+12
-0
+235
-67842
scv
+fdgb
+34f+ert
-56gf
+45 78
------------------


Cheers,
Bernard


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

Date: Tue, 30 Oct 2001 17:13:43 +0200
From: Tassos Chatzithomaoglou <achatz@forthnet.gr>
To: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: regexp simple question
Message-Id: <3BDEC3A7.9CF4C5F8@forthnet.gr>

thx bernard, that seems to work fine...


Bernard El-Hagin wrote:
> 
> On Tue, 30 Oct 2001 16:23:07 +0200, Tassos Chatzithomaoglou
> <achatz@forthnet.gr> wrote:
> > What is the regexp i should if i want to do the following?
> >
> > allow
> > -----
> > +12
> > -0
> > +235
> > -67842
> >
> > deny
> > ----
> > scv
> > +fdgb
> > +34f+ert
> > -56gf
> > +45 78
> >
> > I have tried /^[+-]\d+?/ but it doesn't seem to work...
> 
> ------------------
> while (<DATA>){
>   print if /^[+-]\d+$/;
> }
> 
> __DATA__
> +12
> -0
> +235
> -67842
> scv
> +fdgb
> +34f+ert
> -56gf
> +45 78
> ------------------
> 
> Cheers,
> Bernard

-- 
***************************
Chatzithomaoglou Anastasios
 Network Operations Center
       FORTHnet S.A.
   <achatz@forthnet.gr>
***************************


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

Date: Tue, 30 Oct 2001 15:24:31 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regexp simple question
Message-Id: <slrn9ttet9.tf9.tadmc@tadmc26.august.net>

Tassos Chatzithomaoglou <achatz@forthnet.gr> wrote:

>What is the regexp i should if i want to do the following?
>
>allow
>-----
>+12
>-0
>+235
>-67842


Those look like what you might call a "number", so:

   perldoc -q number

      "How do I determine whether a scalar is a number/whole/integer/float?"


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


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

Date: Tue, 30 Oct 2001 17:26:37 +0100
From: Peter Drechsler <peterd@physik.uni-augsburg.de>
Subject: Re: regexp simple question
Message-Id: <3BDED4BD.1304F7EA@physik.uni-augsburg.de>

Tassos Chatzithomaoglou schrieb:
> 
> thx bernard, that seems to work fine...
> 
> Bernard El-Hagin wrote:
> >
> > On Tue, 30 Oct 2001 16:23:07 +0200, Tassos Chatzithomaoglou
> > <achatz@forthnet.gr> wrote:
> > > What is the regexp i should if i want to do the following?
> > >
> > > allow
> > > -----
> > > +12
> > > -0
> > > +235
> > > -67842
> > >
> > > deny
> > > ----
> > > scv
> > > +fdgb
> > > +34f+ert
> > > -56gf
> > > +45 78
> > >
> > > I have tried /^[+-]\d+?/ but it doesn't seem to work...
> >
> > ------------------
> > while (<DATA>){
> >   print if /^[+-]\d+$/;
> > }
> >
> > __DATA__
> > +12
> > -0
> > +235
> > -67842
> > scv
> > +fdgb
> > +34f+ert
> > -56gf
> > +45 78
> > ------------------
> >
> > Cheers,
> > Bernard
> 

$your_string =~ /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/      # should do the
job.

Peter.


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

Date: 30 Oct 2001 08:46:18 -0800
From: mwangu@yahoo.com (Mike Wangu)
Subject: Useless use of private hash in void context
Message-Id: <ca9aa2d8.0110300846.6d58b914@posting.google.com>

All,

I have the following code in a method called gettree in a module I am
writing to manage a virtual data tree in held in two Oracle tables (one
table contains info on the virtual branches incl. what sub-branches they
have, the other table contains info on the 'virtual leaves' belonging to the
individual branches). This method creates a hash reference of complex
records which are in effect the virtual data tree:

<SNIP>

         # Instantiate current root node data
        @subprojdata = $self->projectattr($croot);
        $projtree = $self->_addnode({}, [ @subprojdata ]);
        # Load start point into walking array
        push @subproj, $croot;

        while ($croot = shift @subproj){
                # get list of child projects - no recursion here
                $subprojdata = [ $self->searchpr($croot) ];

                # Add subbranches to current tree
                map {
                        $projtree->{$_->[0]} =
                                $self->_addnode($projtree->{$_->[3]}, $_);
                        @spdata = @$_;    # Save current project branch data
for use in inner map
                        @projsubs = $self->searchpr($_->[3]) if $recurse;
                        map {
                                local $^W = 0;          # turn off warnings
for this block
                                if ($projtree->{$spdata[0]}){
                                        my %binfo = $projtree->{$spdata[0]};
                                        #XX# Problem line below
                                        $projtree->{$spdata[0]} = ( %binfo,
$self->gettree($spdata[3], $recurse) );
                                } else {
                                        $projtree->{$spdata[0]} =
$self->gettree($spdata[3], $recurse);
                                }
                        } @projsubs if @projsubs;
                } @$subprojdata;
                last unless $recurse;
        }

        return $projtree;

</SNIP>

The code prior to <SNIP> is just formatting and passed parameter checking
stuff - this essentially is the whole method. It takes two parameters:

    $croot    The current root node, AND
    $recurse    A boolean recursion flag - 0 = do not recurse, 1 = recurse

This all works fine on the whole. The problem I am having is the error:

Useless use of private hash in void context at
        /opt/customer/home/pmutyam/release/bin/Vignette/Vignette.pm line 120
(#1)

            [LINE 120 IS THE LINE AFTER #XX# IN THE SNIPPET ABOVE]

When I do:

$rnode->gettree($rootval);

Line 120 is merging two hashes (well, a hash and a hashref) into one. When I
view the $rnode datastructure (using Data::Dumper) it is just as I want it,
but no matter how I attempt to rewrite line 120, I cannot get rid of the
error, even with  $^W set to 0 as above (and this is a category (W) error).

Can anyone see what the problem is? Is there another way to merge this data?

Thank you in advance,

Mike - Freelance programmer, UK


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

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


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