[22830] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5051 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 28 06:05:47 2003

Date: Wed, 28 May 2003 03:05:09 -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           Wed, 28 May 2003     Volume: 10 Number: 5051

Today's topics:
    Re: Advise Needed <deadletters@nabbers.net>
    Re: Advise Needed <deadletters@nabbers.net>
        Bioperl? (entropy123)
    Re: Bioperl? <mgjv@tradingpost.com.au>
    Re: Bioperl? (Anno Siegel)
    Re: Bioperl? <abigail@abigail.nl>
    Re: converting string of [01] to (binary) number <scare.crow@oz.land>
    Re: converting string of [01] to (binary) number <scare.crow@oz.land>
    Re: Doing substitutions in a while loop (while /.../g) <tassilo.parseval@rwth-aachen.de>
        lowercase and uppercase(multi-language) (deny_petr@yahoo.com)
    Re: lowercase and uppercase(multi-language) <w.koenig@acm.org>
    Re: lowercase and uppercase(multi-language) (Anno Siegel)
    Re: module WriteExcel formatting (John McNamara)
    Re: Regexp Multiple Matching Problem <abigail@abigail.nl>
        Reversable loop <ericw@nospam.ku.edu>
    Re: scope of variable (fatted)
    Re: STDOUT print not showing up (Jan)
    Re: STDOUT print not showing up <tassilo.parseval@rwth-aachen.de>
    Re: string search problem (Anno Siegel)
        use of uniinitialized value in concatenation (KT)
        use of uniinitialized value in concatenation (KT)
    Re: use of uniinitialized value in concatenation <ericw@nospam.ku.edu>
    Re: use of uniinitialized value in concatenation (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 28 May 2003 09:10:52 GMT
From: "deadletters" <deadletters@nabbers.net>
Subject: Re: Advise Needed
Message-Id: <w2%Aa.292$UA6.3262658@news-text.cableinet.net>

Hi there,

    Many thanks for the below info....

Catch you later.....John

"David K. Wall" <usenet@dwall.fastmail.fm> wrote in message
news:Xns9388CB22A1533dkwwashere@216.168.3.30...
> "deadletters" <deadletters@nabbers.net> wrote:
>
> > 1. Can I get my hands on a free Perl set of software so as to learn
> > the ropes, if not, whats the best package for a low-end user (as
> > in...needs/wants a few functions but does not know where to start)
>
> You can get Perl for your OS here:
> http://www.perl.com/pub/a/language/info/software.html
>
> Since you appear to be using Windows, that will probably lead you to the
> Activestate.com site.
>
> > 2. If there is a good range to choose from, what should I aim for as
> > a beginner
>
> I'd suggest getting a copy of Randal Schwartz' "Learning Perl",
> ISBN 0-596-00132-0.
>
> > 3. Any other useful tips you may have
>
> See http://learn.perl.org/
>
> or
>
> http://c2.com/cgi/wiki?PerlLanguage for a variety of viewpoints.




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

Date: Wed, 28 May 2003 09:21:01 GMT
From: "deadletters" <deadletters@nabbers.net>
Subject: Re: Advise Needed
Message-Id: <1c%Aa.309$RA6.3259646@news-text.cableinet.net>

Hi there,

    Thanks for the help...I now have "Perl"....so, let the fun begin !!

Regards.....John

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbd7vfk.3br.tadmc@magna.augustmail.com...
> deadletters <deadletters@nabbers.net> wrote:
>
> >     I have just created my first web site and everything in HTML land is
> > average to good so far.
> >
> >     Perl however is another matter. My host supports version 5.6.1 of
> > Perl...but I have not got a clue!!!
>
>
> Can you access a command line on the host's machine?
>
> Or are you restricted to running only those Perl programs that
> conform to the CGI?
>
> If the later, it does not matter what your host has, because you
> should not be learning Perl and CGI stuff at the same time.
>
> Learn Perl first, at home, on your own_ computer, then learn how
> to use Perl for the application-specific (CGI) things.
>
>
> > I am an average to good programmer in Pascal and that's about your lot.
Info
> > I need is :-
> >
> > 1. Can I get my hands on a free Perl set of software so as to learn the
> > ropes,
>
>
> Do you mean example code?
>
> If so, be careful where you get it. Don't learn from code that you
> got at "just any old website".
>
> There is example code posted here in this newsgroup daily (and if it
> is "bad", one of the thousands of other readers will catch it).
>
>
> > if not, whats the best package for a low-end user (as
>
>
> "package"? What do you mean?
>
> Do you mean that you want to run Perl on your home computer so
> that you can start learning Perl?
>
>
> > in...needs/wants a few functions but does not know where to start)
>
>
> Perl is free. There is no "package" to buy. Resist the brainwashing
> you've been subjected to.  :-)
>
>
> > 2. If there is a good range to choose from, what should I aim for as a
> > beginner
>
>
> What you aim for depends on what it is that you want to hit...
>
>
> > 3. Any other useful tips you may have
>
>
> Perl is free. Download and install it.
>
> Assuming you are using Windows at home, click on the little "download"
> it the upper-left corner of:
>
>    http://www.activestate.com/Products/ActivePerl/
>
>
> >     Please accept apologies if I have posted this request in the wrong
> > newsgroup,
>
>
> Nope. This is the right place.
>
> Spend 10 minutes trying to find the answer yourself and if you
> don't find it, then post away!
>
>
>
> There are some helpful Posting Guidelines at:
>
>    http://mail.augustmail.com/~tadmc/clpmisc.shtml
>
>
> There is also a mailing list just for beginners:
>
>    http://lists.perl.org/showlist.cgi?name=beginners
>
>
>
> Forget about CGI for now, learn to use Perl first.
>
>
> -- 
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: 27 May 2003 21:34:28 -0700
From: email_entropy123@yahoo.com (entropy123)
Subject: Bioperl?
Message-Id: <90cdce37.0305272034.7524b4fe@posting.google.com>

Hey all,

I'm still trying to figure out how to write a program to detect cycles
(ring structures) in Perl. If there is any chance this was done in
BioPerl I'd like to find out. Does anyone know where the BioPerl group
is? I go to www.bioperl.org and there does not seem to be any sort of
message group...

Thanks,
entropy


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

Date: Wed, 28 May 2003 05:11:08 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Bioperl?
Message-Id: <slrnbd8h7c.1lr.mgjv@verbruggen.comdyn.com.au>

On 27 May 2003 21:34:28 -0700,
	entropy123 <email_entropy123@yahoo.com> wrote:
> Hey all,
> 
> I'm still trying to figure out how to write a program to detect cycles
> (ring structures) in Perl. If there is any chance this was done in
> BioPerl I'd like to find out. Does anyone know where the BioPerl group
> is? I go to www.bioperl.org and there does not seem to be any sort of
> message group...

On the bioperl web site:

http://www.bioperl.org/MailList.shtml

Martien
-- 
                        | 
Martien Verbruggen      | If at first you don't succeed, try again.
Trading Post Australia  | Then quit; there's no use being a damn fool
                        | about it.


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

Date: 28 May 2003 08:54:56 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Bioperl?
Message-Id: <bb1th0$ntp$1@mamenchi.zrz.TU-Berlin.DE>

entropy123 <email_entropy123@yahoo.com> wrote in comp.lang.perl.misc:
> Hey all,
> 
> I'm still trying to figure out how to write a program to detect cycles
> (ring structures) in Perl. If there is any chance this was done in
> BioPerl I'd like to find out. Does anyone know where the BioPerl group
> is? I go to www.bioperl.org and there does not seem to be any sort of
> message group...

I don't know about BioPerl, but the CPAN is full of modules dealing
with graphs.  Some of those should be able to detect cycles.

Unfortunately, many modules with "Graph" in their name are graphic
modules and don't have to do with graphs in this sense.  You will
need a little patience to sort through them all.

Anno


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

Date: 28 May 2003 09:23:40 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Bioperl?
Message-Id: <slrnbd900s.co.abigail@alexandra.abigail.nl>

entropy123 (email_entropy123@yahoo.com) wrote on MMMDLVII September
MCMXCIII in <URL:news:90cdce37.0305272034.7524b4fe@posting.google.com>:
!!  Hey all,
!!  
!!  I'm still trying to figure out how to write a program to detect cycles
!!  (ring structures) in Perl. If there is any chance this was done in
!!  BioPerl I'd like to find out. Does anyone know where the BioPerl group
!!  is? I go to www.bioperl.org and there does not seem to be any sort of
!!  message group...


Haven't you asked this question a couple of times already?



Abigail
-- 
perl -wlpe '}$_=$.;{' file  # Count the number of lines.


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

Date: Wed, 28 May 2003 08:20:01 +0200
From: Eric Moors <scare.crow@oz.land>
Subject: Re: converting string of [01] to (binary) number
Message-Id: <pan.2003.05.28.08.19.58.860770.17613@oz.land>

On Tue, 27 May 2003 18:52:42 +0200, David Bouman wrote:

> Eric Moors wrote:
> 
>> I'm trying to split a string of n*8 characters in their hexadecimal
>> counterparts. A small example:
>> 
>> As input I have the ascii string:
>> 
>> "0000_0000_0011_0000_1010_1100"
>> 
>> and I want to convert this to the ascii string:
>> 
>> 00
>> 30
>> AC
>> 
>> ...
>> I looked into (un)pack, but couldn't get any lifesign out of that.
> 
> $_ = "0000_0000_0011_0000_1010_1100"; y/_//d; my @r = unpack
> "H2"x(length>>3),pack "B*",$_; print "$_\n" for @r;
> 
> or.. if you want one result string, as you seem to imply:
> 
> my $r = unpack "H*",pack "B*", $_;
> print "$r\n";

This works great.
thanks

Eric


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

Date: Wed, 28 May 2003 08:28:40 +0200
From: Eric Moors <scare.crow@oz.land>
Subject: Re: converting string of [01] to (binary) number
Message-Id: <pan.2003.05.28.08.28.39.956693.17613@oz.land>

>> my %bin2hex = qw(
>>    0000   0    0001   1    0010   2    0011   3 0100   4    0101   5
>>    0110   6    0111   7 1000   8    1001   9    1010   A    1011   B
>>    1100   C    1101   D    1110   E    1111   F
>> );
> 
> 
> A cleaner way of populating the lookup hash might be:
> 
>    my %bin2hex = map { sprintf('%04b', $_), sprintf('%X', $_) } 0..15;

Indeed a nice solution too. Never thought of using a lookuptable for
this.

PS. sorry for the double post. I'm having a problem with
the feed on this newsgroup. I still cannot find my original post, just a
few replies.

Eric


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

Date: 28 May 2003 05:07:32 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Doing substitutions in a while loop (while /.../g)
Message-Id: <bb1g6k$2mq$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Tad McClellan:

> Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:
>> tadmc@augustmail.com (Tad McClellan) wrote in 
>> news:slrnbd7ua0.3br.tadmc@magna.augustmail.com:
>> 
>>> What? You don't re-read perlop.pod every once in a while? 
                    ^^^^^^^^^^^^^^^^^^
>>> 
>>> I do. I find out something I didn't catch the first time each
>>> time I re-read it.
>> 
>> Geek.  ;-)
> 
> 
> I have to have _something_ to read when I'm in the 
> smallest room in my house...

Amazing! I wish I had a pod-viewer in the smallest room of my house. ;-)

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 28 May 2003 02:09:23 -0700
From: deny_petr@yahoo.com (deny_petr@yahoo.com)
Subject: lowercase and uppercase(multi-language)
Message-Id: <fcb3c099.0305280109.42f91433@posting.google.com>

Hi all,

Could u help me?
I want to search a string where are lowercase and uppercase letters.
for example: "Hello".
I `m trying to use "\L" and "\U", but they do not work with "\w".

binmode STDIN;
undef $/; $a = <>;
print "found\n" if $a =~ /(/U/w{1}/E/L/w{4}/E)/;
it do not work.

I can use  $a =~ /([A-Z]{1}[a-z]{4}/;
But it did not support multi-language.

How create a regexp which searchs the string(supporting multi-language)?


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

Date: Wed, 28 May 2003 11:29:03 +0200
From: Winfried Koenig <w.koenig@acm.org>
Subject: Re: lowercase and uppercase(multi-language)
Message-Id: <3ED4815F.3080002@acm.org>



deny_petr@yahoo.com wrote:
> Hi all,
> 
> Could u help me?
> I want to search a string where are lowercase and uppercase letters.
> for example: "Hello".
> I `m trying to use "\L" and "\U", but they do not work with "\w".
> 
> binmode STDIN;
> undef $/; $a = <>;
> print "found\n" if $a =~ /(/U/w{1}/E/L/w{4}/E)/;
> it do not work.
> 
> I can use  $a =~ /([A-Z]{1}[a-z]{4}/;
> But it did not support multi-language.
> 
> How create a regexp which searchs the string(supporting multi-language)?

use locale;

print "found\n" if $a =~ m/\b[[:upper:]][[:lower:]]+\b/;

Winfried Koenig



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

Date: 28 May 2003 10:02:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: lowercase and uppercase(multi-language)
Message-Id: <bb21fu$qvi$1@mamenchi.zrz.TU-Berlin.DE>

deny_petr@yahoo.com <deny_petr@yahoo.com> wrote in comp.lang.perl.misc:
> Hi all,
> 
> Could u help me?
> I want to search a string where are lowercase and uppercase letters.
> for example: "Hello".
> I `m trying to use "\L" and "\U", but they do not work with "\w".

No, they don't.  They translate characters that are given literally,
(directly or interpolated), but they don't change the behavior of
other \-constructs in their range.

> binmode STDIN;
> undef $/; $a = <>;
> print "found\n" if $a =~ /(/U/w{1}/E/L/w{4}/E)/;
> it do not work.
> 
> I can use  $a =~ /([A-Z]{1}[a-z]{4}/;
> But it did not support multi-language.
> 
> How create a regexp which searchs the string(supporting multi-language)?

Try unicode properties ( /\p{IsUpper}/ ) or Posix style character classes
( /[[:upper:]]/ ).  Which one works for you will depend on your Perl
version, your locale settings, and if you are using utf8.

Anno


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

Date: 28 May 2003 02:19:46 -0700
From: jmcnamara@cpan.org (John McNamara)
Subject: Re: module WriteExcel formatting
Message-Id: <8cceb2da.0305280119.58056ece@posting.google.com>

tivolinewbie@canada.com (Kenjis Kaan) wrote ...

> The problem I see is that after perl has write a
> XLS file, when I open it, all the columns seems to partially cover the
> one before it.

This is the standard Excel behaviour.


> So is there a way you can instruct the formatting so that you can
> arbitrary describe how wide you want the column, or even to set it to
> be as long as the longest string in the column??

There is no way to specify "AutoFit" for a column in the Excel file
format. This feature is only available at runtime from within Excel.
Instead you will have to specify the column width explicitly:

    $worksheet->set_column(0, 0,  20); # Column  A   width set to 20
    $worksheet->set_column(1, 3,  30); # Columns B-D width set to 30
    $worksheet->set_column('E:E', 20); # Column  E   width set to 20
    $worksheet->set_column('F:H', 30); # Columns F-H width set to 30

See the set_column() method in the documentation:

http://search.cpan.org/dist/Spreadsheet-WriteExcel/WriteExcel.pm#set_column_first_col_last_col_width_format_hidden_level_


> The other thing I am trying to do is to set the foreground/background
> colour to
> a very specific colour based on RGB notation, so 'red','brown' just
> isn't good
> enough, I would like to specify it as "FF0000" for red, and "0000FF"
> for blue and anywhere in between, "CCAAFF", or "D3F8AA" etc.

You can generate a RGB colour via the set_custom_color() workbook
method:

    $workbook->set_custom_color(40, 255,  102,  0   ); # Orange
    $workbook->set_custom_color(40, 0xFF, 0x66, 0x00); # Same thing
    $workbook->set_custom_color(40, '#FF6600'       ); # Same thing

http://search.cpan.org/dist/Spreadsheet-WriteExcel/WriteExcel.pm#set_custom_color_index_red_green_blue_

See also, the section entitled "Colours in Excel" in the
Spreadsheet::WriteExcel documentation:

http://search.cpan.org/dist/Spreadsheet-WriteExcel/WriteExcel.pm#COLOURS_IN_EXCEL


John.
--


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

Date: 28 May 2003 09:31:01 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Regexp Multiple Matching Problem
Message-Id: <slrnbd90el.co.abigail@alexandra.abigail.nl>

Eric Amick (eric-amick@comcast.net) wrote on MMMDLVII September MCMXCIII
in <URL:news:t938dvc67acfto88nrgoh53p3p1qq32hsc@4ax.com>:
^^  On 23 May 2003 06:29:52 -0700, jonasb@alum.rpi.edu (Big Brother) wrote:
^^  
^^ >Thanks for your replies. I figured I'd be a little more specific with
^^ >the code. I'm pretty sure that the problem lies in the variable that I
^^ >use to get the matched string, but I've looked through the docs and am
^^ >not sure what to use.
^^ >
^^ >        if ($_=~m/$RE{net}{IPv4}{dec}{-keep}/g)   #Find IP Address
^^  
^^  -keep looks like an expression to Perl, so it won't be quoted the way
^^  the other subscripts are. Unless you have a function called keep, I
^^  suspect you really want '-keep' with the quotes.  If my assumption is
^^  correct, you can also change the /g to /go since the subscript values
^^  (and hence the hash element selected) won't change.  That will keep the
^^  regex from being recompiled each time.

Using -keep without the quotes is fine. It's special cased. '-keep' means
the same as '- "keep"', and results in the string "-keep".



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


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

Date: Wed, 28 May 2003 04:58:30 GMT
From: Eric Wilhelm <ericw@nospam.ku.edu>
Subject: Reversable loop
Message-Id: <pan.2003.05.27.23.55.22.131412.32388@nospam.ku.edu>

Is there another way to do this? (needs to also be nestable e.g.
for(i){for(j){do stuff}})



@set = (  [39, "<=", 42, "+"],
                [42, ">=", 39, "-"] );
foreach $dir (@set) {
        $i_start = $$dir[0];
        $test = $$dir[1];
        $i_last = $$dir[2];
        $inc_op = $$dir[3];
        for($i = $i_start; eval("$i $test $i_last"); $i+=eval("$inc_op 1") ) {
                print "i:  $i  ";
                }
        print "\n";
        }

While the eval statements are somewhat clunky, they seem to be the best
way to handle reversing of the "<" and ">" operators.

--Eric


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

Date: 28 May 2003 00:38:47 -0700
From: fatted@yahoo.com (fatted)
Subject: Re: scope of variable
Message-Id: <4eb7646d.0305272338.6bdadb7@posting.google.com>

"Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in message news:<Xns938873665DB6Aelhber1lidotechnet@62.89.127.66>...
<snip> 
> 
> You must be doing something else wrong, because the code above does exactly 
> what you want.
>
<snip>

Oops, I jumped to conclusions about where the problem was! (Always
blame the first thing you see :)
I think I've found out where the problem is though:
Since I've been putting the program in an infinite loop, I've been
stopping it with ^C.
So program 1:

use warnings;
use strict;

open(OUT,'>>','program.log') or die $!;
while(1)
{
print OUT "I must not jump to conclusions\n";
}

When this is run and then ^C'ed (^C quickly :) The program.log file is
created (wasn't there before) with the string printed (several times
:)

Now try program 2:

use warnings;
use strict;

open(OUT,'>>','program.log') or die $!;
while(1)
{
sleep(1);
print OUT "banana\n";
}

When this is run and ^C'ed after several seconds, the program.log file
is created (wasn't there before) as expected but not a single banana
to be seen. I also tried program 2 with $| = 1; but with the same
results. Also if a print OUT is put after the open but before the
while loop, this doesn't write to the file either (even with $| = 1).

Does this mean lack of sleep is good for your perl programming?
(sorry) Any further thoughts?


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

Date: 28 May 2003 02:55:13 -0700
From: jan_buys@hotmail.com (Jan)
Subject: Re: STDOUT print not showing up
Message-Id: <11971c2c.0305280155.52fa12ae@posting.google.com>

jan_buys@hotmail.com (Jan) wrote in message news:<11971c2c.0305270934.1d337c62@posting.google.com>...
> Hello,
> 
> Feeling a bit newbie here for asking such stupid question.
> 
> I have a problem when printing to a default STDOUT command-line
> window.  What I basically do is print a bunch of info to STDOUT and in
> the end I ask a question to the user of the script.  (I use the normal
> print command and some HERE documents for that).
> 

code snippet :



use CQPerlExt;

$version = "0.1";
$debug = 1;

$ARGC = @ARGV;
if ($ARGC != 1) {print "_CFW_support_close : argument ticketNumber
missing.\n"; exit(1);}

##### NOTE : if argument is wrong : The text IS shown.

my $ticketNumber = $ARGV[0];
chomp ($ticketNumber);


##############################################################################
#
#                               HEADER
#
##############################################################################
print "\n\n\n Loading _CFW_support_close version $version -
jan.buys\@server.com\n\n";

##### NOTE : This does not show up !!!

<...SNIP...>

##############################################################################
#
#              Let the CFW Support person decide whether this is the
#              correct ticket that has been handled and of which the
#              external partner should be notified.
#
##############################################################################

print <<EOF;
You have chosen to notify the external party about the fact their
issue has been handled.
Before we do so, let's run through a check whether we have the right
ticket.

You have chosen to notify $externalReference about their issue :
$headline

Do you want to check the complete description of this issue (y/N) ?
EOF

##### NOTE : This does not show up until the code underneath has run.

my $answer = <STDIN>;
chomp($answer);
if ($answer =~ /[yY]|yes|YES/)
{
  print <<EOF;
  The complete description field reads :
  $description
EOF
}


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

Date: 28 May 2003 10:00:39 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: STDOUT print not showing up
Message-Id: <bb21c7$hgi$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Jan:

> Feeling a bit newbie here for asking such stupid question.
> 
> I have a problem when printing to a default STDOUT command-line
> window.  What I basically do is print a bunch of info to STDOUT and in
> the end I ask a question to the user of the script.  (I use the normal
> print command and some HERE documents for that).
> 
> Problem is : the text is not showing up in the console (normal cmd.exe
> console) and the script just waits for an answer to the question
> (which, of course, is not visible).  Only when I answer it, all text
> output that should have been printed prior to waiting for answer is
> printed.  Not quite userfriendly, unless you're clairvoyant, which
> most common users are not.
> 
> I've been looking at the code for hours and at exactly similar scripts
> I made in the past, but I cannot find the problem.  Does this ring a
> bell somewhere ?

Yes, it does. It commonly happens under Windows where output appears to
be a little too aggressively buffered (and too seldom flushed). Add this
line to the top of your script:

    $| = 1;

This will force a flush after each write to the selected output channel.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 28 May 2003 07:32:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: string search problem
Message-Id: <bb1on7$k1k$1@mamenchi.zrz.TU-Berlin.DE>

Allanon <allanon@hotmail.com> wrote in comp.lang.perl.misc:
> 
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:bavna4$9hs$3@mamenchi.zrz.TU-Berlin.DE...
> > Allanon <allanon@hotmail.com> wrote in comp.lang.perl.misc:
> > >
> > > "Marco" <ver_for@yahoo.it> wrote in message
> > > news:da63f24c.0305270159.18aece5d@posting.google.com...
> > > > Hi,
> > > >
> > > > I have a script that search some certain keywords in a file.
> > > > The test to know if the keyword is present is the following one:
> > > >
> > > > if ($ligne=~ m/$keyword/gsi & $keyword_dans_ce_fichier==0)
> > > >
> > > > With this, if one of the keywords is "tur". The answer will positive
> > > > if the word "turnover" is present in the file.
> > >
> > > if ($ligne=~ m/\b$keyword\b/gsi & $keyword_dans_ce_fichier==0)
> >                                   ^
> > The "&" operation performs a bit-wise logical and of its arguments.  Ii
> > think you (and the OP) want "&&".
> 
> Oh yes.. I always use "and" myself.. would it matter in that context?

No difference in this case.  Both "=~" and "==" bind tighter than
"&&" (and much tighter than "and"), so the result is the same for
"and" and "&&".

Anno


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

Date: 27 May 2003 21:40:56 -0700
From: kennedyel_5000@yahoo.com (KT)
Subject: use of uniinitialized value in concatenation
Message-Id: <6495f466.0305272040.5323c147@posting.google.com>

Hi all

how come this always generate complier error "use of uninitialized
value in concatenation

line print "$1"; does work, but not $2 and $3, what's wrong in the
following code ?

x=a|b|c;

if ($x=~/(\w+)|(\w+)|(\w+)/) {
										
print "$1"
print "$2";
print "$3";


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

Date: 27 May 2003 21:42:59 -0700
From: kennedyel_5000@yahoo.com (KT)
Subject: use of uniinitialized value in concatenation
Message-Id: <6495f466.0305272042.6d4564fb@posting.google.com>

Hi all

how come this always generate complier error "use of uninitialized
value in concatenation

line print "$1"; does work, but not $2 and $3, what's wrong in the
following code ?

x=a|b|c;

if ($x=~/(\w+)|(\w+)|(\w+)/) {
										
print "$1"
print "$2";
print "$3";


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

Date: Wed, 28 May 2003 04:53:20 GMT
From: Eric Wilhelm <ericw@nospam.ku.edu>
Subject: Re: use of uniinitialized value in concatenation
Message-Id: <pan.2003.05.27.23.50.11.847762.32388@nospam.ku.edu>

On Tue, 27 May 2003 23:42:59 -0500, KT wrote:

> Hi all
> 
> how come this always generate complier error "use of uninitialized value
> in concatenation
> 
> line print "$1"; does work, but not $2 and $3, what's wrong in the
> following code ?
> 
> x=a|b|c;
> 
> if ($x=~/(\w+)|(\w+)|(\w+)/) {
> 										
> print "$1"
> print "$2";
> print "$3";

The | is the alternation operator.  To find it in a regex, you will need
to \ it (may also need to do this in your x=a\|b\|c string.)

--Eric


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

Date: 28 May 2003 07:40:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: use of uniinitialized value in concatenation
Message-Id: <bb1p4i$k1k$2@mamenchi.zrz.TU-Berlin.DE>

KT <kennedyel_5000@yahoo.com> wrote in comp.lang.perl.misc:
> Hi all
> 
> how come this always generate complier error "use of uninitialized
> value in concatenation

That's a run-time warning, not a compiler error.  There's a difference.

> line print "$1"; does work, but not $2 and $3, what's wrong in the
> following code ?
> 
> x=a|b|c;
> 
> if ($x=~/(\w+)|(\w+)|(\w+)/) {
> 										
> print "$1"
> print "$2";
> print "$3";

Eric has already explained why this captures only one value.

Anno


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

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


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