[22137] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4358 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 7 11:06:45 2003

Date: Tue, 7 Jan 2003 08:05:13 -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           Tue, 7 Jan 2003     Volume: 10 Number: 4358

Today's topics:
    Re: A Good Perl Book <barryk2@SPAM-KILLER.mts.net>
    Re: Detecting media change/closing of CD tray? (Sam Holden)
    Re: error with @ sign <barryk2@SPAM-KILLER.mts.net>
    Re: Filenames on Win32: the bane of my existence.... (Ben Morrow)
    Re: insert newlines in a long string <sfarris9@insightbb.com>
    Re: insert newlines in a long string <uri@stemsystems.com>
    Re: Noob:  Variable is getting reset, but why? <erutiurf@web.de>
    Re: Perl quotations problem (Tad McClellan)
    Re: Perl quotations problem <jurgenex@hotmail.com>
        pointer & stack data structure? <mark_chou@hotmail.com>
    Re: pointer & stack data structure? <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: pointer & stack data structure? <usenet@tinita.de>
    Re: pointer & stack data structure? (Helgi Briem)
    Re: pointer & stack data structure? <jurgenex@hotmail.com>
    Re: Problem with huge dataset, 100000000 a magic number <bart.lateur@pandora.be>
    Re: Reg Expression help <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: Reg Expression help <bongie@gmx.net>
        These are discouraging stats to Perlistas & Pythonistas (Sara)
    Re: These are discouraging stats to Perlistas & Pythoni <james.mcininch@_NOSPAM_.attbi.com>
    Re: top-posting (was Re: regexp question) <jurgenex@hotmail.com>
    Re: using subroutines defined in other scripts <jvandervloet@hotmail.com>
    Re: using subroutines defined in other scripts (Sam Holden)
    Re: using subroutines defined in other scripts <nobody@dev.null>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 7 Jan 2003 08:19:30 -0600
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: A Good Perl Book
Message-Id: <MPG.18849de9ff53a7f39896c4@news.mts.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <1041892886.117181@ananke.eclipse.net.uk>, Steve C 
(sjcole@hotmail.com) says...
> Hiya Folks,
> 
> I'm just about to order the O'Reilly book: Programming Perl (Authors Larry
> Wall, Tom Christiansen, Jon Orwant)
> I know there's plenty of online material - but you know, I like to be able
> to read something in the local pub / bar ! (sad !!)
> 
> Is this book to be recommended by the many perl gurus on this NG, or should
> I be considering something different ?
> For information: I have only ever programmed in PASCAL, BASIC, COBOL, Visual
> Basic (Arrgghh!) and more recntly dabbled with PHP4
> 
> Many Thanks
> 
> Steve C.

I highly recommend "Programming Perl" (commonly known as "The Camel"). 
This book is more a language reference manual than it is a book to teach 
you how to program in Perl. There is the O'Reilly book known as "The 
Lama" (title is something like "Learning to Program in Perl"); this book 
is more of a Perl instruction book.


-- 
---------

Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com


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

Date: 7 Jan 2003 14:27:36 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Detecting media change/closing of CD tray?
Message-Id: <slrnb1louo.tnd.sholden@flexal.cs.usyd.edu.au>

On Tue, 7 Jan 2003 13:29:28 +0100, Frank Maas <spamfilter@cheiron-it.nl> wrote:
> Hi,
> 
>  I tried to find something on this subject on the web, but probably used
> the wrong keywords. What I want to do is detect if someone closes the
> CD-ROM player (on a laptop) from within Perl. Since it is not certain
> that a CD is placed in it, I cannot simply check for the capacity or
> such a thing.
> The system is running Linux, kernel 2.4.17. My search included 'how does
> Linux tell me...', but that did not result in something useful either.
> 
> I would be delighted if you could help me on this!

i don't see linux in the name of this group, why don't try a group
which does in fact have such a word in its name.

-- 
Sam Holden



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

Date: Tue, 7 Jan 2003 08:14:38 -0600
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: error with @ sign
Message-Id: <MPG.18849ccb66d92a909896c3@news.mts.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <3d9b1ac6.0301061356.7e27a7fa@posting.google.com>, Mac 
(schuckm@emigrant.com) says...
> I am writing out html with the perl print funtion and am getting and
> error when I use the "@" sign.  I figured this may be because
> 

The "@" is a special character in Perl. It is the array name indicator. 
Therefor if you want to print it you must "escape" it (i.e. prcede it by 
a backslash)

-- 
---------

Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com


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

Date: Tue, 7 Jan 2003 14:46:53 +0000 (UTC)
From: mauzo@ux-ma160-15.csv.warwick.ac.uk (Ben Morrow)
Subject: Re: Filenames on Win32: the bane of my existence....
Message-Id: <avep8t$s8j$1@wisteria.csv.warwick.ac.uk>

drsmithhm@hotmail.com (drsmith) wrote:
>pkent <pkent77tea@yahoo.com.tea> wrote in message news:<pkent77tea-87D383.01101710122002@news-text.blueyonder.co.uk>...
>> In article <c7c208d1.0212091255.6b0849cb@posting.google.com>,
>>  drsmithhm@hotmail.com (drsmith) wrote:
>> 
>> > The problem is that many of the filenames contain dates, spaces, and
>> > other special characters like umlat's.  Perl's readdir function is
>> > returning '?' characters in place of the special characters which
>> > later on causes unlink() to fail.
<snip>
>> 
>The problem is files that get created from the Mac have a different
>encoding for some of the characters.  For instance, if I save a file
>with a date - 'My Research Grant - 12/10/2002' becomes 'My Research
>Grant - 12?10?2002' on the server.  The / is a legal character on the
>Mac, but it get's turned into '?' characters on the actual server. 
>Trying to unlink() these files always fails.
>
>If anyone has a solution or suggestion, I'd appreciate it.

Just a random suggestion: does using -C help any?
You could also try some nasty trick along the lines of spawning a dir/ls 
process redirected to a file and then reading that file.

What are the mac files actually called? ie.
What are they called in Explorer?
What does Perl's readdir return?
What does dir call them?
Are the slashes preserved from the point of view of the Mac users? If they are,
then they must be something other than a question mark really...

Ben


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

Date: Tue, 07 Jan 2003 15:19:16 GMT
From: steven farris <sfarris9@insightbb.com>
Subject: Re: insert newlines in a long string
Message-Id: <UdCS9.469940$pN3.51041@sccrnsc03>

steven farris wrote:

> Hello, how could i take a long string in perl
> and insert newlines at the whitespace nearest
> to 80 chars? So a string that contains 320 chars
> would have roughly 5 newlines inserted into
> it.

Thanks for all the suggestions. Obviously Text::Wrap
is the way to go. Oddly enough, this problem is one of
the few where a homegrown solution would be easier to
accomplish in C where strings are arrays as opposed
to Perl scalars.


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

Date: Tue, 07 Jan 2003 15:52:24 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: insert newlines in a long string
Message-Id: <x7d6n9ufd3.fsf@mail.sysarch.com>

>>>>> "sf" == steven farris <sfarris9@insightbb.com> writes:

  sf> steven farris wrote:
  >> Hello, how could i take a long string in perl and insert newlines
  >> at the whitespace nearest to 80 chars? So a string that contains
  >> 320 chars would have roughly 5 newlines inserted into it.

  sf> Thanks for all the suggestions. Obviously Text::Wrap is the way to
  sf> go. Oddly enough, this problem is one of the few where a homegrown
  sf> solution would be easier to accomplish in C where strings are
  sf> arrays as opposed to Perl scalars.

i highly doubt that. people have shown you one line regex solutions
but the modules do the job better. a c solution would involve a loop of
several lines at least.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


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

Date: Tue, 07 Jan 2003 15:29:52 +0100
From: Richard Voss <erutiurf@web.de>
Subject: Re: Noob:  Variable is getting reset, but why?
Message-Id: <aveocd$a75$04$1@news.t-online.com>

Tad McClellan wrote:
> Joe Smith <inwap@inwap.com> wrote:
> 
> 
>>The while(<INPUT>) statement does an
>>implicit open() of each file named on the command line.
> 
> No, that's the    while(<>)    statement that does that.  :-)
> 
> 
> (actually any use of the <> diamond operator does that, whether
>  in a while or elsewhere.
> )
> 

I'd say the use of the ARGV handle does that, whether implicitly via <> or elswhere.

-- 
sub{*O=*Time::HiRes::usleep;require Time::HiRes;unshift@_,(45)x 24,split q=8=
=>55.52.56.49.49.55.56.49.49.53;do{print map(chr,@_[0..(@_/2-1)])=>"\b"x(@_/2
);O(0xA**6/6)=>push@_=>shift}for@_,++$|}->(map{$_+=$_%2?-1:1}map ord,split//,
'u!`onuids!Qdsm!i`bjds')#my email-address is reversed!   http://fruiture.de



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

Date: Tue, 7 Jan 2003 08:07:31 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl quotations problem
Message-Id: <slrnb1lnp3.fof.tadmc@magna.augustmail.com>

Cmps <cmps7331@hotmail.com> wrote:

> I am not sure about the compatibility possibilities, but I have encountered
> the following error 


I don't see any error following...


> $str1="friendlynospam"+"@"+".org";


> When correctly changed to $str1='friendlynospam'+'@'+'.org' it
> amazingly works.  


That is indeed amazing, since it does not appear to be correctly changed. :-)

(unless you _wanted_ $str1 to get a value of zero.)


> The point of the matter is you can debug for hours and miss this one point.


Not if you have warnings enabled...


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


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

Date: Tue, 07 Jan 2003 15:44:33 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl quotations problem
Message-Id: <BBCS9.15499$1c.9039@nwrddc01.gnilink.net>

Cmps wrote:
> I am not sure about the compatibility possibilities, but I have
> encountered the following error when testing Perl/CGI scripts on
> ActivePerl versus actual server running.  The following is an example:
>
> $str1="friendlynospam"+"@"+".org";
> $str2="filename.ext";
>
> Note the quoatations in split quotations in $str1 and no-split in
> $str2. $str2 is a whole string, commonly recognized.  $str1 is a
> broken string, but usually excepted by most scripts.  Now if you test
> it on ActivePerl, it executes ok.  However, attempting to run this on
> the server, it will not execute.

Maybe your web server runs CGI scripts with strictures and warnings enabled.
You should, too. Then you would have noticed the following warning:

    Argument "@" isn't numeric in addition (+) at C:\tmp\t.pl line 4.
    Argument "friendlynospam" isn't numeric in addition (+) at C:\tmp\t.pl
line 4.
    Argument ".org" isn't numeric in addition (+) at C:\tmp\t.pl line 4.

> When correctly changed to
> $str1='friendlynospam'+'@'+'.org' it amazingly works.

Please define "works". I still get the same warning.

> Other quoation
> rules do not matter as they work fine.  But firstly, single quotes
> are commonly for character referencing though I know in Perl and
> scripts this is not always true.  But why then is this not allowed in
> the joining of quotations in the first manner with $str1.  Is there
> some rule about Perl here?

But you are not joining the strings. You are adding their numerical values.
If you want to join text then use the join operator ".".

jue




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

Date: Tue, 07 Jan 2003 22:46:36 +0800
From: Mark Chou <mark_chou@hotmail.com>
Subject: pointer & stack data structure?
Message-Id: <3E1AE84C.3010207@hotmail.com>

Dear Perl Guru,

Does Perl support pointer & stack data structure? It would be even 
better if you could provide simple example.

Thanks,

Mark
Mark_chou@hotmail.com



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

Date: Tue, 07 Jan 2003 16:04:13 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: pointer & stack data structure?
Message-Id: <newscache$17nc8h$rt5$1@news.emea.compuware.com>

Mark Chou wrote (Tuesday 07 January 2003 15:46):

> Dear Perl Guru,
> 
> Does Perl support pointer & stack data structure? It would be even
> better if you could provide simple example.
> 
> Thanks,
> 
> Mark
> Mark_chou@hotmail.com


In Perl you will generally never have to be concerned about the 
impossibility of data structures. Perl allows whatever data structure you 
can imagine. So if you can think of it, Perl can do it (including stacks 
and lists)

HTH.

-- 
KP



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

Date: 7 Jan 2003 15:07:26 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: pointer & stack data structure?
Message-Id: <tinh8co1i$171$tina@news01.tinita.de>

Mark Chou <mark_chou@hotmail.com> wrote:
> Dear Perl Guru,

so there's only one guru? may i answer, too?

> Does Perl support pointer & stack data structure?

Perl has no pointers, it has references.
read
 perldoc perldata  and
 perldoc perlref
for learning about them.
perldoc comes with your perl-installation and is
online at www.perldoc.com

> It would be even 
> better if you could provide simple example.

my $number = 42;
my $reference_to_number = \$number;
$$reference_to_number++; # $number is now 43

but, as i said, learn about all the details by reading the docs.
hth, tina

-- 
http://www.tinita.de/        \  enter__| |__the___ _ _ ___
http://Movies.tinita.de/      \     / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/   \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Tue, 07 Jan 2003 15:09:20 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: pointer & stack data structure?
Message-Id: <3e1aeb5f.302175595@news.cis.dfn.de>

On Tue, 07 Jan 2003 22:46:36 +0800, Mark Chou
<mark_chou@hotmail.com> wrote:

>Dear Perl Guru,

Who's that?

>Does Perl support pointer & stack data structure? 

Short answer: No.

Longer answer: Perl is a high level language and
implements those machine-level data structures with 
higher level constructs.

>It would be even better if you could provide simple example.

Perl has three basic types of data structures:

1) Scalars, used for keeping simple data such
as strings, integers, floating point numbers and 
binary data.

my $scalar = "word 4.5";

2) Arrays, for keeping lists of scalar values
indexed by array position (0 based).

my @array = qw/one two three/;
print $array[1];

# returns two

3) Hashes, for keeping lists of values indexed
by key, rather than by array position.  The hash
is used for creating more complex data structures.

my %hash;
my $hash{'first'} = 'one';
my $hash{'second'} = 'two';
print $hash{'second'; 

#returns two

Read 'perldoc perldata' for details and 
'perldoc perlguts' if you really want some
low-level messy detail.

-- 
Regards, Helgi Briem
helgi AT decode DOT is


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

Date: Tue, 07 Jan 2003 15:49:53 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: pointer & stack data structure?
Message-Id: <BGCS9.4583$gb.2229@nwrddc03.gnilink.net>

Mark Chou wrote:
> Does Perl support pointer & stack data structure? It would be even
> better if you could provide simple example.

The equivalent of pointers is called 'references' in Perl (the semantics are
slightly different, references are much more programmer-friendly). Please
see "perldoc perlref" for details.

Stacks are already part of the Perl language as arrays, please see "perldoc
perlfunc" for details. Excerpt:
    Functions for real @ARRAYs
        "pop", "push", "shift", "splice", "unshift"

jue




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

Date: Tue, 07 Jan 2003 14:52:51 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Problem with huge dataset, 100000000 a magic number?
Message-Id: <ttpl1v4mm4tbm6n87bt2hdfppo5ne8dgm6@4ax.com>

John W. Krahn wrote:

>         my ( undef, undef, undef, $source_ip, $source_port,
>             undef, $dest_ip, $dest_port, undef, undef,
>             $packets, $octets ) = split;

That works ?!?! Gee, that must be a fairly recent addition. I'm sure I
tried something like it with 5.005 or so, and it failed to compile. I
haven't tried it since. Iv'e used a syntax like

          ( undef, undef, undef, my $source_ip, my $source_port,
             undef, my $dest_ip, my $dest_port, undef, undef,
             my $packets, my $octets ) = split;

ever since.

The odd thing is that I can't find any trace of this in perldelta (for
5.6, 5.005, 5.004). perlfunc and perlsub don't seem to mention it,
either. Odd.

-- 
	Bart.


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

Date: Tue, 7 Jan 2003 14:23:05 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Reg Expression help
Message-Id: <avens9$g4m$1@korweta.task.gda.pl>

In article <3e1ade4c$1@nntp.onyx.net>, Steven Coutts wrote:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:avemkp$5pr$3@mamenchi.zrz.TU-Berlin.DE...
>> Steven Coutts <scoutts.work@btinternet.com> wrote in comp.lang.perl.misc:
>> > Just a quickie, been puzzling over this I'm not too hot on regular
>> > expressions, how would I write a reg exp to replace '+' signs with
> spaces?
>>
>> What have you tried, and where's the problem?
>
>
> Tried   /\+\+S/


The first problem with that is that you top-posted it.


The second is that it doesn't replace anything because
it's neither a substitution nor a transliteration. It
would *match* two + signs followed directly by an S.


Which brings us to the third problem, which is that the
regex is wrong.


Try reading about the tr/// and s/// operators and about regexes
by issuing the following commands:


perldoc perlop
perldoc perlre


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: Tue, 07 Jan 2003 16:18:53 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: Reg Expression help
Message-Id: <2396841.AoBvX0EPNQ@nyoga.dubu.de>

Steven Coutts wrote:
> Just a quickie, been puzzling over this I'm not too hot on regular
> expressions, how would I write a reg exp to replace '+' signs with
> spaces?

Don't try to parse CGI parameters yourself.  Let CGI.pm do it for you.

(I know, it's not an answer to the question, but I'm quite sure it
matches the original problem... ;-) )

Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I ran three miles today, finally I said "lady take your purse."
                -- Emo Phillips



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

Date: 7 Jan 2003 07:21:23 -0800
From: genericax@hotmail.com (Sara)
Subject: These are discouraging stats to Perlistas & Pythonistas...
Message-Id: <776e0325.0301070721.7405a312@posting.google.com>

Looks like Bill is successfully creating his "clone army". 

At least we're way above PHP, which barely beat Fortran! Lords of
Light it's amazing anyone who isn't one of Bill's or Sun's drones is
employed.... It looks like a Perl programmer has about an equal chance
of being employed in his skill as a COBOL programmer, and probably for
a lot less $$ since COBOL programmers have to be scarce as hens teeth.

This is discouraging.... I guess next year at OSCON we should replace
the Python talks with "Labview" and "PowerBuilder" to attract more
attendees? I'd be a parking attendant  before I'd learn ASP. You may
be taking over the world Bill but you ain't getting ME!

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


Recent DICE survey resuts:

>Number of Job Listings by Programming Language (January 3, 2003)
>
>               monster.com dice.com %
>
>  SQL          5000        2486     24.06%
>
>  ASP          2156        2480     14.90%
>
>  Java         2664        1862     14.55%
>
>  C++          2046        1480     11.33%
>
>  Visual Basic 2037        1095     10.07%
>
>  Perl         925         548      4.73%
>
>  Javascript   914         489      4.51%
>
>  Cobol        595         532      3.62%
>
>  SAS          805         269      3.45%
>
>  C#           284         179      1.49%
>
>  Ada          377         65       1.42%
>
>  RPG          248         163      1.32%
>
>  PowerBuilder 155         106      0.84%
>
>  PHP          189         30       0.70%
>
>  Delphi       157         55       0.68%
>
>  Fortran      121         49       0.55%
>
>  LabVIEW      108         27       0.43%
>
>  Tcl          73          33       0.34%
>
>  Python       55          32       0.28%
>
>  Smalltalk    41          30       0.23%
>
>  Rexx         33          25       0.19%
>
>  Pascal       28          17       0.14%
>
>  Lisp         12          9        0.07%
>
>  SML          7           6        0.04%
>
>  Haskell      6           6        0.04%
>
>  Caml         0           0        0.00%
>


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

Date: Tue, 07 Jan 2003 15:59:38 GMT
From: James McIninch <james.mcininch@_NOSPAM_.attbi.com>
Subject: Re: These are discouraging stats to Perlistas & Pythonistas...
Message-Id: <KPCS9.599571$%m4.185506@rwcrnsc52.ops.asp.att.net>

For Perl programmers, don't look for Perl as the keyword. Look for 
"informatics", and "systems administrator". Perl is a tool, not an 
occupation in and of itself.

For example, SQL is rated high, but useless by itself. You certainly can't 
write an entire application in SQL alone...



On Tuesday 07 January 2003 10:21 am, Sara posted to comp.lang.perl.misc:

> Looks like Bill is successfully creating his "clone army".
> 
> At least we're way above PHP, which barely beat Fortran! Lords of
> Light it's amazing anyone who isn't one of Bill's or Sun's drones is
> employed.... It looks like a Perl programmer has about an equal chance
> of being employed in his skill as a COBOL programmer, and probably for
> a lot less $$ since COBOL programmers have to be scarce as hens teeth.
> 
> This is discouraging.... I guess next year at OSCON we should replace
> the Python talks with "Labview" and "PowerBuilder" to attract more
> attendees? I'd be a parking attendant  before I'd learn ASP. You may
> be taking over the world Bill but you ain't getting ME!
> 
>  -------------------------------------------------------------------------
> 
> 
> Recent DICE survey resuts:
> 
>>Number of Job Listings by Programming Language (January 3, 2003)
>>
>>               monster.com dice.com %
>>
>>  SQL          5000        2486     24.06%
>>
>>  ASP          2156        2480     14.90%
>>
>>  Java         2664        1862     14.55%
>>
>>  C++          2046        1480     11.33%
>>
>>  Visual Basic 2037        1095     10.07%
>>
>>  Perl         925         548      4.73%
>>
>>  Javascript   914         489      4.51%
>>
>>  Cobol        595         532      3.62%
>>
>>  SAS          805         269      3.45%
>>
>>  C#           284         179      1.49%
>>
>>  Ada          377         65       1.42%
>>
>>  RPG          248         163      1.32%
>>
>>  PowerBuilder 155         106      0.84%
>>
>>  PHP          189         30       0.70%
>>
>>  Delphi       157         55       0.68%
>>
>>  Fortran      121         49       0.55%
>>
>>  LabVIEW      108         27       0.43%
>>
>>  Tcl          73          33       0.34%
>>
>>  Python       55          32       0.28%
>>
>>  Smalltalk    41          30       0.23%
>>
>>  Rexx         33          25       0.19%
>>
>>  Pascal       28          17       0.14%
>>
>>  Lisp         12          9        0.07%
>>
>>  SML          7           6        0.04%
>>
>>  Haskell      6           6        0.04%
>>
>>  Caml         0           0        0.00%
>>

-- 
remove "_NOSPAM_." from address to reply


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

Date: Tue, 07 Jan 2003 16:00:05 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: top-posting (was Re: regexp question)
Message-Id: <9QCS9.15617$1c.3296@nwrddc01.gnilink.net>

Helgi Briem wrote:
> On Tue, 07 Jan 2003 04:43:59 GMT, "Jürgen Exner"
> <jurgenex@hotmail.com> wrote:
> I disagree that posting more text than old text is
> necessary for a properly formatted post.

[valid example snipped]

True for your example. And probably for other examples, too.
However having such a policy would stop 99.9% of TOFU posts.

Personally I could life with the inconvenience of maybe having to add an
additional line every now and then. OTOH it makes you think twice about how
much quoting is really necessary.

jue




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

Date: Tue, 07 Jan 2003 14:20:35 GMT
From: "joeri" <jvandervloet@hotmail.com>
Subject: Re: using subroutines defined in other scripts
Message-Id: <TmBS9.94049$Ti2.13283@afrodite.telenet-ops.be>

This is a multi-part message in MIME format.

------=_NextPart_000_005E_01C2B660.532E63E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

'use warnings' doesn't produce any kind of feedback.
'use strict' gives all sorts of trouble... Too much to print here and in =
fact none
of the info actually refers to &pushnew.

The subs file also contains the following:

sub get_position ($@) {
    $item =3D shift;
    for ($i=3D0;$i<@_;$i++) {
        if ($item eq $_[$i]) {
            push (@found, $i);
        }
    }
    @found;
}

This does work when I try the following:

require "c:/perl/lib/subs/perlsubs.pl";

@seen =3D qw/I have/;
@pos =3D get_position("have", @seen);
print "POS: @pos\n";
which yields: POS: 1



So it must have sth to do with the way the pushnew sub is implemented. I =
just can't see

what is going wrong.



"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message =
news:avejuf$5pr$2@mamenchi.zrz.TU-Berlin.DE...
> joeri <jvandervloet@hotmail.com> wrote in comp.lang.perl.misc:
> > OK,
> >=20
> > suppose this is what the subs file has:
> >=20
> > sub pushnew (\@@) {
> >     my $array =3D shift;
> >     while (@_) {
> >         push @$array, $_[0] unless grep $_[0] eq $_, @$array;
> >         shift;
> >     }
> > }
> > 1;
> >=20
> > In a new script, I write the following:
> >=20
> > require "c:/perl/lib/subs/perlsubs.pl";
> >=20
> > @seen =3D qw/I have/;
> > pushnew(@seen, "seen");
> > print "@seen\n";
> >=20
> > This should print "I have seen" normally, but it just prints "I =
have".
> >=20
> > How come?
>=20
> You're running without strict and warnings.  Switch them on and see
> if things become clearer.
>=20
> Anno
------=_NextPart_000_005E_01C2B660.532E63E0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>'use warnings' doesn't produce any kind =
of=20
feedback.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>'use strict' gives all sorts of =
trouble... Too much=20
to print here and in fact none</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>of the info actually refers to=20
&amp;pushnew.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The subs file also contains the=20
following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P><FONT face=3DArial size=3D2>sub get_position ($@) =
{<BR>&nbsp;&nbsp;&nbsp; $item =3D=20
shift;<BR>&nbsp;&nbsp;&nbsp; for ($i=3D0;$i&lt;@_;$i++) =
{<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; if ($item eq $_[$i]) {<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; push (@found, =
$i);<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;=20
@found;<BR>}</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2>This does work when I try the=20
following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>require=20
"c:/perl/lib/subs/perlsubs.pl";</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>@seen =3D qw/I have/;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>@pos =3D get_position("have", =
@seen);<BR>print "POS:=20
@pos\n";</FONT></DIV>
<DIV>
<P><FONT face=3DArial size=3D2>which yields: POS: 1</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2>So it must have sth to do with the way =
the pushnew=20
sub is implemented. I just can't see</FONT></P>
<P><FONT face=3DArial size=3D2>what is going wrong.</FONT></P>
<P>&nbsp;</P></DIV>
<DIV><FONT face=3DArial size=3D2>"Anno Siegel" &lt;</FONT><A=20
href=3D"mailto:anno4000@lublin.zrz.tu-berlin.de"><FONT face=3DArial=20
size=3D2>anno4000@lublin.zrz.tu-berlin.de</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
wrote in message </FONT><A=20
href=3D"news:avejuf$5pr$2@mamenchi.zrz.TU-Berlin.DE"><FONT face=3DArial=20
size=3D2>news:avejuf$5pr$2@mamenchi.zrz.TU-Berlin.DE</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; joeri =
&lt;</FONT><A=20
href=3D"mailto:jvandervloet@hotmail.com"><FONT face=3DArial=20
size=3D2>jvandervloet@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
comp.lang.perl.misc:<BR>&gt; &gt; OK,<BR>&gt; &gt; <BR>&gt; &gt; suppose =
this is=20
what the subs file has:<BR>&gt; &gt; <BR>&gt; &gt; sub pushnew (\@@) =
{<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; my $array =3D shift;<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; while (@_) {<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push @$array, $_[0] =
unless=20
grep $_[0] eq $_, @$array;<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shift;<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&gt; &gt; }<BR>&gt; &gt; 1;<BR>&gt; =
&gt;=20
<BR>&gt; &gt; In a new script, I write the following:<BR>&gt; &gt; =
<BR>&gt; &gt;=20
require "c:/perl/lib/subs/perlsubs.pl";<BR>&gt; &gt; <BR>&gt; &gt; @seen =
=3D qw/I=20
have/;<BR>&gt; &gt; pushnew(@seen, "seen");<BR>&gt; &gt; print=20
"@seen\n";<BR>&gt; &gt; <BR>&gt; &gt; This should print "I have seen" =
normally,=20
but it just prints "I have".<BR>&gt; &gt; <BR>&gt; &gt; How =
come?<BR>&gt;=20
<BR>&gt; You're running without strict and warnings.&nbsp; Switch them =
on and=20
see<BR>&gt; if things become clearer.<BR>&gt; <BR>&gt; =
Anno</FONT></BODY></HTML>

------=_NextPart_000_005E_01C2B660.532E63E0--



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

Date: 7 Jan 2003 14:34:14 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: using subroutines defined in other scripts
Message-Id: <slrnb1lpb6.tp1.sholden@flexal.cs.usyd.edu.au>

On Tue, 07 Jan 2003 14:20:35 GMT, joeri <jvandervloet@hotmail.com> wrote:
> This is a multi-part message in MIME format.
> 
> ------=_NextPart_000_005E_01C2B660.532E63E0
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> 
> 'use warnings' doesn't produce any kind of feedback.
> 'use strict' gives all sorts of trouble... Too much to print here and in =
> fact none
> of the info actually refers to &pushnew.

use strict gives a message for me, using just the code you posted
(in two files). 

Maybe you should fix all the problems use strict is pointing out
while you're at it anyway...

-- 
Sam Holden



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

Date: Tue, 07 Jan 2003 15:15:03 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: using subroutines defined in other scripts
Message-Id: <3E1AEE22.9020902@dev.null>



Anno Siegel wrote:

> joeri <jvandervloet@hotmail.com> wrote in comp.lang.perl.misc:
> 
>>
>>I have a particular perl script, which contains some useful subroutines


[snip]


>>When I start writing a new script, I don't want to restate this subroutine
>>every time in each new script (when needed).
>>
>>What I would like to be able to do is just let the new script 'use' the
>>subroutines stated in this subroutine-gathering


[snip]


> 
> "require" goes in the right direction, but what most people use for
> your purpose is "use" (perldoc -f use) combined with Exporter (perldoc
> Exporter).  See "perldoc perlmod" for how to put them together.
> 

I wish someone would write "perlmodtut", a good tutorial about modules 
for people whose only experience with them comes from using them. 
Perlmod seems to be starting at the intermediate level.






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

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


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