[24217] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6409 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 16 06:05:37 2004

Date: Fri, 16 Apr 2004 03:05:06 -0700 (PDT)
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, 16 Apr 2004     Volume: 10 Number: 6409

Today's topics:
        $1 <nospam@nospam.net>
    Re: $1 (Anno Siegel)
    Re: Checking whether a socket has been closed by the pe <vek@station02.ohout.pharmapartners.nl>
    Re: Checking whether a socket has been closed by the pe <jlell@jakoblell.de>
    Re: Grabbing data from telnet host (Anno Siegel)
    Re: Handling international characters in filenames on W <nmihai_year_2000@yahoo.com>
    Re: Help!! Cannot insert TIMESTAMP after upgrade. <myudkinATcompuserveDOTcom@nospam.org>
    Re: One question <bik.mido@tiscalinet.it>
    Re: One question <bik.mido@tiscalinet.it>
    Re: One question <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: One question (Sam Holden)
        porting from pl/1 anuradha.k.r@sify.com
    Re: porting from pl/1 <Joe.Smith@inwap.com>
    Re: porting from pl/1 (Anno Siegel)
    Re: porting from pl/1 <nospam@bigpond.com>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
        sub should return modified value (Bart Van der Donck)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 16 Apr 2004 06:23:32 GMT
From: "Jeff Thies" <nospam@nospam.net>
Subject: $1
Message-Id: <EZKfc.10529$zj3.10411@newsread3.news.atl.earthlink.net>

I have a regex with a bracket retrieving $1:

$variable=~/(need a match)/;

#  doing something with $1;

$another_regex=~s/a/b/;

 whoa, $1 gets clobbered if there is a substitution.

Why is that? I never remember reading about that.

What else sets $1, $2 ...?

Is there a way to localize that, or should I just set: my $one_match=$1
after the regex parenthesis match?

  Jeff






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

Date: 16 Apr 2004 09:23:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: $1
Message-Id: <c5o8mp$rtm$1@mamenchi.zrz.TU-Berlin.DE>

Jeff Thies <nospam@nospam.net> wrote in comp.lang.perl.misc:
> I have a regex with a bracket retrieving $1:
> 
> $variable=~/(need a match)/;
> 
> #  doing something with $1;
> 
> $another_regex=~s/a/b/;
> 
>  whoa, $1 gets clobbered if there is a substitution.
> 
> Why is that? I never remember reading about that.

It's pretty much all over the place.  See perlre for instance, look for
a paragraph starting with "The numbered match variables...".

> What else sets $1, $2 ...?
> 
> Is there a way to localize that,

As the cited paragraph says, they are automatically localized to the
surrounding block.

>                                  or should I just set: my $one_match=$1
> after the regex parenthesis match?

You can do that.  In most cases you don't need $1 etc. for that:

    my ( $one_match) = $string =~ /(need a match)/;

assigns the match to $one_match.  The match must be in list context for this
to work, hence the parentheses around "$one_match".  Specify more variables
if you have more captures.

Anno


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

Date: 16 Apr 2004 07:01:04 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: Checking whether a socket has been closed by the peer
Message-Id: <slrnc7v15g.3fp.vek@station02.ohout.pharmapartners.nl>

On Thu, 15 Apr 2004 21:44:47 +0200,
    Jakob Lell <jlell@jakoblell.de> wrote:


> Hello,
> how can I check whether the client has closed an IO::Socket::INET?
> According to the description, the connected-Method of IO::Socket should
> return undef if the socket isn't connected. However, this doesn't work
> when the peer has closed the connection. When you run the script below
> and connect to port 1234 from another terminal using netcat or telnet and
> then close the connection, the script will continue to write "connected\n"
> to STDOUT every second.
>
> use IO::Socket;
> my $sock=IO::Socket::INET->new(LocalPort=>1234,Listen=>5,ReuseAddr=>1)||die $!;
> while(my $client=$sock->accept()){
>     next unless defined($client);
>     $client->blocking(0);
>     while(defined $client->connected){
>         print "connected\n";
>         sleep(1);
>     }
> }
>



The normal way to detect a peer close is reading from the socket and
the peer close is indicated by returning an EOF condition.  The socket
is considered connected as long there are still bytes to be read from
the socket even after the peer has actualy closed.

Villy


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

Date: Fri, 16 Apr 2004 10:58:05 +0200
From: Jakob Lell <jlell@jakoblell.de>
Subject: Re: Checking whether a socket has been closed by the peer
Message-Id: <pan.2004.04.16.08.58.05.557411@jakoblell.de>

On Fri, 16 Apr 2004 07:01:04 +0000, Villy Kruse wrote:

> The normal way to detect a peer close is reading from the socket and
> the peer close is indicated by returning an EOF condition.  The socket
> is considered connected as long there are still bytes to be read from
> the socket even after the peer has actualy closed.

Hello,
I know I could try to read from the socket and check for an EOF condition.
However, as I'm using nonblocking IO, I want to check whether the
connection is still alive without reading from the socket. eof even
returns 1 if the connection is still active but there is nothing to read
at the moment.

Regards
  Jakob


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

Date: 16 Apr 2004 09:29:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Grabbing data from telnet host
Message-Id: <c5o914$rtm$2@mamenchi.zrz.TU-Berlin.DE>

Mark <markp@asnet.co.nz> wrote in comp.lang.perl.misc:
> I have a script setup to log into a host using the Net::Telnet CPAN
> module.
> It logs on to this host, sends a username and password and then sends
> some commands, prints a message to the screen and then closes the
> session.
> 
> This is working fine for the purpose but I would like to modify it so
> that I can get a status of the host before I send commands to change
> the configuration of the host.
> 
> I would like to do something like the following: (bear with me my
> psuedocode aint that great)
> 
> get <system route table>
>   put output -> $variable
>       grep $variable "0.0.0.0 0.0.0.0 192.168.1.1" -> $newvariable
>       if $newvariable = "0.0.0.0 0.0.0.0 192.168.1.1" then 
>          print = "Device online"
>       else 
>          print = "Device not online"
>       end if
> 
> Any ideas?

Most people use ping for that.

Anno


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

Date: Fri, 16 Apr 2004 09:35:17 GMT
From: "Mihai N." <nmihai_year_2000@yahoo.com>
Subject: Re: Handling international characters in filenames on Win32
Message-Id: <Xns94CD1A5875086MihaiN@63.240.76.16>


Some notes, additions and corrections:
> Sounds like one of those codeset conversion problems. DOS uses cp850 and 
> windows uses cp1252 
DOS and the Windows actual console (which "symulates" the DOS prompt)
The DOS/console code page is also called OEM code page.
The Windows code page is also called (not 100% correct) ANSI code page.
Also, 850 was the OEM used for most Western European languages.
For English U.S. systems the OEM cp is 437.

> which is the same for 'normal' characters but 
> differs wrt wide characters.
Not wide characters, just "high ascii" or "accented characters"

> It's a fairly simple task using Text::Iconv 
> to convert from one to the other - which would be one way to get around 
> the problem. It's probably just as simple to convert from one to the 
> other using the Encode module which is part of the perl core with perl 
> 5.8 (though I've not used it).
Main problem here: there are characters in 1252 that are not present
in 850/437.


-- 
Mihai
-------------------------
Replace _year_ with _ to get the real email


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

Date: Fri, 16 Apr 2004 08:12:45 +0200
From: "Mark Yudkin" <myudkinATcompuserveDOTcom@nospam.org>
Subject: Re: Help!! Cannot insert TIMESTAMP after upgrade.
Message-Id: <c5ntet$eol$1@ngspool-d02.news.aol.com>

Install FP5.

"Hemant Shah" <shah@typhoon.xnet.com> wrote in message
news:c47n6s$6kk$1@flood.xnet.com...
>
> Folks,
>
>  I recently upgraded/migrated my database from UDB 7.2 on AIX to UDB 8.1
on
>  Linux. Now I cannot insert data into a TIMESTAMP column. The string I am
>  using for TIMESTAMP is in ISO format.
>
>  The old database was using ISO-8859-1 character set, the new database is
>  using UTF-8. I have a perl script that inserts data into one of the table
>  that has time stamp column. The script worked in UDB 7 database but fails
>  with SQL0180N in UDB 8.
>
>
> 1246:         $InsertStmt_CodeChanged_Hdl->execute($SourceNum, $RevBranch,
$RevDecimal,
> 1247:                                     $TimeStamp, $Author, $Command,
$SubCommand,
> 1248:                                     $LinesAdded, $LinesDeleted);
>   DB<2> p $TimeStamp
> 2004-03-28-17:06:39.816398
>   DB<3> n
> lidp12|InsertCodeChangedData: DBD::DB2::st execute failed: [IBM][CLI
Driver][DB2/LINUX] SQL0180N  The syntax of the string representation of a
datetime value is incorrect.  SQLSTATE=22007
>
>
> I tried to run following command on the client system but that did not
help
> either.
>
>  db2 bind @db2cli.lst DATETIME ISO blocking all grant public
>  db2 bind @db2ubind.lst DATETIME ISO blocking all grant public
>
>  How can I fix it? I need to fix it A.S.A.P.
>
>  Thanks.
>
> -- 
> Hemant Shah                           /"\  ASCII ribbon campaign
> E-mail: NoJunkMailshah@xnet.com       \ /  --------------------- 
>                                        X     against HTML mail
> TO REPLY, REMOVE NoJunkMail           / \      and postings
> FROM MY E-MAIL ADDRESS.
> -----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
> I haven't lost my mind,                Above opinions are mine only.
> it's backed up on tape somewhere.      Others can have their own.




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

Date: Fri, 16 Apr 2004 08:48:56 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: One question
Message-Id: <i21u701qhg8mvqs9ov49o4p3rdovkljgnh@4ax.com>

On Thu, 15 Apr 2004 12:17:52 -0400, Sherm Pendley
<spamtrap@dot-app.org> wrote:

>I needed to make it executable (chmod), add a #! line at the beginning, and
>convert line-endings from DOS to UNIX style in the script and all the text
 ^^^^^^^^^^^^^^^^^^^^
>input files. I also commented out the definition of $programdirectory and
>the related chdir.

Is that really necessary? It is my personal experience that it is
plainly not needed except, obviously, for the shebang line itself.


Micheke
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Fri, 16 Apr 2004 08:48:57 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: One question
Message-Id: <tuuu70tqgioh6haoj2900qiorm6o0sc0lj@4ax.com>

On Thu, 15 Apr 2004 20:34:20 GMT, "edgrsprj" <edgrsprj@ix.netcom.com>
wrote:

>> Wait, a horrible thought occured to me - are you reading a fixed number of
>> chracters at a time, instead of just using <> to read a line at a time?
>> Egads...
>
>The number of characters in the lines on different system is confusing it.
>With my system I told it to compare the string with the complete line minus
>one character.  With other systems that apparently causes an error.  This is
>easy to correct.  When it reads a fixed number of characters on the line it
>runs Ok.

  while (<>) {
    chomp;
    ...
  }

>I am enjoying working with Perl.  It is a little unforgiving regarding code
>violations but quite versatile and fast.  And it can digest and work with

Your claim is nonsense as it is written now, but trying to make sense
of it in the most obvious way I can think of, I'd comment it like
this:

Huh?!? Ever met a thing called "C" or "C" plus... err, well, "plus"?


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Fri, 16 Apr 2004 08:41:12 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: One question
Message-Id: <Xns94CD586294845elhber1lidotechnet@62.89.127.66>

"edgrsprj" <edgrsprj@ix.netcom.com> wrote:

> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnc7u2l5.efa.tadmc@magna.augustmail.com...
>> edgrsprj <edgrsprj@ix.netcom.com> wrote:
> 
>> What programming language _is_ forgiving regarding code
>> violations? 
> 
> I like this one version of Basic that I used for years.  If you
> did something wrong then when you told it to run it let you know
> in no uncertain terms that you were mistaken!
> 
> A problem with running Perl from Windows is the fact that if you
> start a program using a shortcut file and there is an error in it,
> nothing happens. The screen flashes for a second and you have no
> idea what went wrong.  There are ways around that.  But I have not
> yet figured out how to best deal with the problem.  You can start
> it from DOS and see the error messages.  But that means more work
> dropping down to DOS and changing directories etc 


And how is that a Perl problem? It's clearly an OS problem and has 
nothing to do with Perl.


-- 
Cheers,
Bernard


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

Date: 16 Apr 2004 07:40:10 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: One question
Message-Id: <slrnc7v3eq.1b3.sholden@flexal.cs.usyd.edu.au>

On Thu, 15 Apr 2004 22:18:20 GMT, edgrsprj <edgrsprj@ix.netcom.com> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnc7u2l5.efa.tadmc@magna.augustmail.com...
>> edgrsprj <edgrsprj@ix.netcom.com> wrote:
> 
>> What programming language _is_ forgiving regarding code violations?
> 
> I like this one version of Basic that I used for years.  If you did
> something wrong then when you told it to run it let you know in no uncertain
> terms that you were mistaken!

As does perl, though it does sometimes get confused about where exactly
the problem lies - especially with if/else constructs.

 
> A problem with running Perl from Windows is the fact that if you start a
> program using a shortcut file and there is an error in it, nothing happens.
> The screen flashes for a second and you have no idea what went wrong.  There
> are ways around that.  But I have not yet figured out how to best deal with
> the problem.  You can start it from DOS and see the error messages.  But
> that means more work dropping down to DOS and changing directories etc

That is clearly not a Perl problem. Or even a perl problem. It isn't
even a Windows problem since getting around that is in fact trivial
enough. It is a documentation problem (and I guess arguably an interface
problem with windows) since it failed to inform you of how to do it.
You did read the documentation right? Do a help search? Take a guess?

And no I'm not being mean and nasty, I don't remember how to do it and I
don't have a windows machine to check with. I do recall it being simple,
probably in the "properties" of the file (or even more likely of the
extra little file windows creates with DOS programs - .pif I think?).

of course that's off topic for a perl group...

-- 
Sam Holden


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

Date: 15 Apr 2004 23:39:48 -0700
From: anuradha.k.r@sify.com
Subject: porting from pl/1
Message-Id: <57efaf35.0404152239.bec9cb4@posting.google.com>

hi,
I am new to pl1,and do not have proper documentation to the language.
I wanted to know what put page does.What I understand is the sysprint file 
will have specific page size and line size,which we mention during sysprint file 
open itself.like
	open file(sysprint) pagesize(84) linesize(136);
and put page will take up a new page once the pagesize exceeds.
My intention is to port the pl1 file to perl.However I've notheard 
of such concepts in perl.Can any one give me the equivalent of this function?
thanx,
AKR.


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

Date: Fri, 16 Apr 2004 08:41:36 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: porting from pl/1
Message-Id: <3%Mfc.154757$JO3.92908@attbi_s04>

anuradha.k.r@sify.com wrote:

> 	open file(sysprint) pagesize(84) linesize(136);
> and put page will take up a new page once the pagesize exceeds.
> My intention is to port the pl1 file to perl.

Take a look at `perldoc perlform` - you'll see that perl's special
variable $= has the number of lines per page, which is used by
the write() function (but not the print() function).
	-Joe


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

Date: 16 Apr 2004 09:04:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: porting from pl/1
Message-Id: <c5o7ir$qsg$2@mamenchi.zrz.TU-Berlin.DE>

 <anuradha.k.r@sify.com> wrote in comp.lang.perl.misc:
> hi,
> I am new to pl1,and do not have proper documentation to the language.

Then get it.  It's the one most important thing you need when working
with a new language.

> I wanted to know what put page does.What I understand is the sysprint file 
> will have specific page size and line size,which we mention during
> sysprint file 
> open itself.like
> 	open file(sysprint) pagesize(84) linesize(136);
> and put page will take up a new page once the pagesize exceeds.

Get the documentation and look up the functions.  If you don't understand,
ask a PL1 group, not a Perl group.

> My intention is to port the pl1 file to perl.However I've notheard 
> of such concepts in perl.Can any one give me the equivalent of this function?
> thanx,

Perhaps, but it's your job to find out what exactly you need done.

Anno



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

Date: Fri, 16 Apr 2004 19:40:05 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: porting from pl/1
Message-Id: <2198885.id8J1L0EiY@GMT-hosting-and-pickle-farming>

anuradha.k.r@sify.com wrote:

> hi,
> I am new to pl1,and do not have proper documentation to the language.
> I wanted to know what put page does.What I understand is the sysprint file
> will have specific page size and line size,which we mention during
> sysprint file open itself.like
> open file(sysprint) pagesize(84) linesize(136);
> and put page will take up a new page once the pagesize exceeds.
> My intention is to port the pl1 file to perl.However I've notheard
> of such concepts in perl.Can any one give me the equivalent of this
> function? thanx,
> AKR.

PL/I and Perl (note the spelling/capitalisations) are about 3 decades apart
in development. 

All the PL/I linesize and pagesize stuff is for fixed width line printers.
The standard page size was 132 columns and 66 lines IIRC.

But thee days we tend to use proportional fonts in various sizes and use
complex printer control languages. If you just pipe to lpr under linux
unix/bsd you will get fixed fonts and control-l will generate a new page.

If you post a link to the PL/I we could give you more hints on converting.

gtoomey


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

Date: Fri, 16 Apr 2004 01:22:41 -0500
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <0OCdnfbChvos5uLdRVn-hg@august.net>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://mail.augustmail.com/~tadmc/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume 

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    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!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



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

Date: 16 Apr 2004 02:46:02 -0700
From: bart@nijlen.com (Bart Van der Donck)
Subject: sub should return modified value
Message-Id: <b5884818.0404160146.421b1fc8@posting.google.com>

Hello,

Suppose this code:

# ---------------------------
$a=2;
print "variable a has now value '$a'.\n";
&addone($a);
print "variable a has now value '$a'.\n";
sub addone
{
$b=shift;
$b++;
return $b;
}
# ---------------------------

gives as result:

variable a has now value '2'.
variable a has now value '2'.

Is it possible to have $a at value '3' after executing the sub ?
I tried with 'return', 'shift' and so, but couldn't find a way so that
$a would directly be affected by what happens in sub &addone (without
variable $a is mentionned in sub &addone obviously).

Thanks for tips or hints
Bart


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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