[25470] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7715 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 31 09:05:34 2005

Date: Mon, 31 Jan 2005 06:05:18 -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           Mon, 31 Jan 2005     Volume: 10 Number: 7715

Today's topics:
    Re: [perl-python] sending email <steve@holdenweb.com>
        Error in command line (Marcelo)
    Re: Error in command line <1usa@llenroc.ude.invalid>
    Re: FAQ 4.16 How can I find the Julian Day? <ebohlman@omsdev.com>
        Foreign characters in file name - can't open() <szpara_ga@tlen.pl>
    Re: Foreign characters in file name - can't open() (replace z with h, spam protection)
    Re: Foreign characters in file name - can't open() <someone@example.com>
    Re: Just wondering - variables in html templates <tadmc@augustmail.com>
    Re: Just wondering - variables in html templates <tadmc@augustmail.com>
    Re: Just wondering - variables in html templates <phaylon@dunkelheit.at>
    Re: ldap server can not replace the order of login, why (jiing)
    Re: Perl equivalent for Unix ps. <nospam@bigpond.com>
    Re: Perl loops should use break, not last <abigail@abigail.nl>
    Re: Perl loops should use break, not last <abigail@abigail.nl>
    Re: Perl loops should use break, not last <do-not-use@invalid.net>
        Perl newbie -  getting "system()" to return (Jean-Benoit MORLA)
    Re: Perl newbie -  getting "system()" to return <1usa@llenroc.ude.invalid>
    Re: Perl newbie - getting "system()" to return <georgekinley@hotmail.com>
        printing PDF in win32 (mike)
    Re: printing PDF in win32 <nobull@mail.com>
    Re: printing PDF in win32 <sppNOSPAM@libello.com>
        recursive function and hashe <sppNOSPAM@libello.com>
    Re: recursive function and hashe <phaylon@dunkelheit.at>
        regexp inside <> + typos in perldoc <hendrik_maryns@despammed.com>
    Re: Replace text inside html tags? <bart.lateur@pandora.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 31 Jan 2005 07:48:27 -0500
From: Steve Holden <steve@holdenweb.com>
Subject: Re: [perl-python] sending email
Message-Id: <zTpLd.101046$Jk5.42830@lakeread01>

Chris Mattern wrote:

> YYusenet wrote:
> 
> 
>>Xah Lee wrote:
>>  [snip]
>>
>>>The first two has glaring problems. I'm sorry i forgot what they
>>
>>                   ^^^^^^^^^^^^^^^^^           ^^^^^^^^^^^^^^^^^^
>>
>>>are.
>>
>> ^^^^
>>  [snip]
>>
>>How can you complain about *Mail::Mailer* and *Mail::Send* when you
>>don't even know what they are?
>>
> 
> You know, I started to make fun of that, but then decided there was
> nothing I could say that it doesn't say for itself.
> 
We interrupt this insanity, since followups were set to 
comp.lang.perl.misc, to ask whether any of the (clearly extremely 
tolerant) Perl users who didn't plonk this Xah Lee nonsense weeks ago 
might be interested in attending a Python conference - to be specific, 
PyCon, see http://www.pycon.org/. The conference took (some of) its 
inspiration from YAPC in terms of low cost and community involvement, 
and I'm sure there is still lots for us to learn from each other.

Fraternally yours
Steve Holden
PyCon DC 2005 Chair
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119


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

Date: 31 Jan 2005 05:21:53 -0800
From: mnarvaja@yahoo.com (Marcelo)
Subject: Error in command line
Message-Id: <b1570347.0501310521.75fa1e5d@posting.google.com>

Try using qq (double quote):

perl -le "print qq|PRIME| if (1 x shift) !~ /^(11+)\1+$/" 19

Regards,
Marcelo


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

Date: Mon, 31 Jan 2005 13:37:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Error in command line
Message-Id: <Xns95EF57BF48B89asu1cornelledu@127.0.0.1>

mnarvaja@yahoo.com (Marcelo) wrote in 
news:b1570347.0501310521.75fa1e5d@posting.google.com:

> Try using qq (double quote):
> 
> perl -le "print qq|PRIME| if (1 x shift) !~ /^(11+)\1+$/" 19

What are you replying to?

You should reply in the thread where your message is relevant and also 
provide some context to your post.

Please read the posting guidelines for this group and assorted information 
on the UseNet such as

http://nnqweb.tripod.com/nnqlinks.html#how

Sinan.


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

Date: 31 Jan 2005 10:18:33 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: FAQ 4.16 How can I find the Julian Day?
Message-Id: <Xns95EF2D1952C5Febohlmanomsdevcom@130.133.1.4>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in
news:ctjcjt$h4n$3@mamenchi.zrz.TU-Berlin.DE: 

>> >     There is too many details and much confusion on this issue to
>> >     cover in 
>> 
>> s/is/are/  for number agreement between verb and predicate
>> nominative. 
> 
> Doesn't work:
> 
>     There are too many details and much confusion ...
> 
> Better:
> 
>     There is too much detail and confusion ...

This is an argument for moving to an XML-based version of POD.  Then you'd 
be able to write:

<item xml:lang="en-gwb">There is too many details and much confusion on 
this issue to cover in ... </item> :)



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

Date: 30 Jan 2005 23:49:17 -0800
From: "P" <szpara_ga@tlen.pl>
Subject: Foreign characters in file name - can't open()
Message-Id: <1107157757.832039.266160@z14g2000cwz.googlegroups.com>


Hi,

I use File::Find to go through some directories and grab
files with a .log extension. I then open() each of these logs
and do some processing on them. The mechanism itself works as
expected, but I run into trouble when a log's file name has
foreign characters in it (like German umlauts, for example).
So in this snippet:


find ( \&process(), '/starting/path' );

sub process {
return unless /\.log$/;

open ( LOG, $_ ) or die $!;

# go on to process file
}


open() refuses to open files with umaluts in the name (claiming
"File not found", even though the file is present).

I thought that "use utf8" might solve the problem, but it
seems that it's used to allow foreign characters in the _script_,
but it has no effect whatsoever on the script's _input_. Can
someone please suggest how to get my script to read those pesky
foreign character files?


Thank you.

-- 
Jenny



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

Date: Mon, 31 Jan 2005 09:20:42 +0100
From: "D. Marxsen" <detlef.marxsen@tdds-gmbz.de (replace z with h, spam protection)>
Subject: Re: Foreign characters in file name - can't open()
Message-Id: <ctkpos$4n3$1@domitilla.aioe.org>

"P" <szpara_ga@tlen.pl> schrieb im Newsbeitrag
news:1107157757.832039.266160@z14g2000cwz.googlegroups.com...
> I use File::Find to go through some directories and grab
> files with a .log extension. I then open() each of these logs
> and do some processing on them. The mechanism itself works as
> expected, but I run into trouble when a log's file name has
> foreign characters in it (like German umlauts, for example).
 ...
> open() refuses to open files with umaluts in the name (claiming
> "File not found", even though the file is present).

Well, I don't use File::Find but use an own construct shown below. Just set
$direc (e. g. "d:\copy\") and $recursive (e. g. 0) appropriately.

use English;
use strict;

sub collect
{
 my $direc = $ARG[0];

 my $fullname;        # File name including path
 my $line;         # One line of directory info
 my $record;        # One record of the result
 my $timestring;       # String containing time info
 my @filelist;        # List of contained files
 my @stat;         # Result of stat command

 opendir(DIRFILE,$direc)||die("Fail: Open directory: ",$!);
 rewinddir(DIRFILE);
 while (defined ($line=readdir(DIRFILE)))
 {
   next if $line eq '.';
   next if $line eq '..';
  (@filelist)=(@filelist,$line);
 }
 close(DIRFILE);
 foreach(@filelist)
 {
  $fullname=sprintf "%s%s\\",$direc,$ARG;
  if (-d $fullname)
  {
   if ($recursive==1)          # User can suppress recursive operation
   {
    &collect($fullname);
   }
  }
  else
  {
   $fullname=~s/\\$//;          # Files don't need a trailing backslash
   @stat=stat($fullname);
   $timestring=localtime($stat[9]);
   $record=sprintf ("%s\t%d Bytes\t%s",$fullname,$stat[7],$timestring);
   printf("%s\n",$record);
  }
 }

It makes no problems when coming across German umlauts - you can pass the
$fullname variable to an open command without problems. So you may give it a
try.

Cheers,
Detlef.

--
D. Marxsen, TD&DS GmbH
detlef.marxsen@tdds-gmbz.de (replace z with h, spam protection)




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

Date: Mon, 31 Jan 2005 09:21:49 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Foreign characters in file name - can't open()
Message-Id: <NMmLd.84230$Qb.41378@edtnps89>

P wrote:
> 
> I use File::Find to go through some directories and grab
> files with a .log extension. I then open() each of these logs
> and do some processing on them. The mechanism itself works as
> expected, but I run into trouble when a log's file name has
> foreign characters in it (like German umlauts, for example).
> So in this snippet:
> 
> 
> find ( \&process(), '/starting/path' );
> 
> sub process {
> return unless /\.log$/;
> 
> open ( LOG, $_ ) or die $!;
> 
> # go on to process file
> }
> 
> 
> open() refuses to open files with umaluts in the name (claiming
> "File not found", even though the file is present).
> 
> I thought that "use utf8" might solve the problem, but it
> seems that it's used to allow foreign characters in the _script_,
> but it has no effect whatsoever on the script's _input_. Can
> someone please suggest how to get my script to read those pesky
> foreign character files?

It could be that the magic involved in the two argument form of open() is what 
is causing your problem.  Try it with the three argument open() or sysopen() 
instead.

perldoc perlopentut


John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 31 Jan 2005 07:06:11 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Just wondering - variables in html templates
Message-Id: <slrncvsba3.n1u.tadmc@magna.augustmail.com>

Seansan <sheukels=cuthere=@yahooo.co.uk> wrote:

> Sherm start a hobby


Seansan go away.



[ snip TOFU yet again ]

Message-ID: <3de012b4$0$2246$e4fe514c@dreader6.news.xs4all.nl>

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


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

Date: Mon, 31 Jan 2005 07:06:53 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Just wondering - variables in html templates
Message-Id: <slrncvsbbd.n1u.tadmc@magna.augustmail.com>

Alan J. Flavell <flavell@ph.gla.ac.uk> wrote:
> On Sun, 30 Jan 2005, Seansan blurted out atop a fullquote:
> 
>> Sherm start a hobby
> 
> I knew you'd be finding your way into the killfile before long,


He earned a spot in mine in 2002.


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


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

Date: Mon, 31 Jan 2005 14:10:32 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Just wondering - variables in html templates
Message-Id: <pan.2005.01.31.13.10.32.598693@dunkelheit.at>

Seansan wrote:

> Sherm start a hobby

I see, you have to be the new "I don't need the regulars"-guy.
Good luck. Score adjusted.


p

-- 
http://www.dunkelheit.at/

The eternal mistake of mankind is to set up an attainable ideal.
                              -- Aleister Crowley



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

Date: 31 Jan 2005 00:13:23 -0800
From: jiing.deng@gmail.com (jiing)
Subject: Re: ldap server can not replace the order of login, why?
Message-Id: <b7b95676.0501310013.4ef30b81@posting.google.com>

sorry for mis posting

Sherm Pendley <spamtrap@dot-app.org> wrote in message news:<5q-dnaj1iMZ8AmDcRVn-hA@adelphia.com>...
> This is a Perl group, not a PHP group.
> 
> sherm--


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

Date: Mon, 31 Jan 2005 15:19:48 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Perl equivalent for Unix ps.
Message-Id: <365tfoF4t1f60U1@individual.net>

Prab_kar@hotmail.com wrote:

> Hi all,
> Is there any Perl function which works like the Unix ps command?
> I've looked through the manuals for Perl functions and couldnt find
> anything similar in nature.
> 
> I'm rewriting a Bourne shell script in Perl and the sh script uses the
> ps from a lot of different places, /usr/bin/ps sometimes, /usr/ucb/ps
> other times. I wanted to rewrite in Perl to get over that, and in all
> the examples I see, the Perl scripts use /usr/bin/ps or /usr/ucb/ps in
> backticks or from system("<PATH>/ps").
> 
> Is there anyway I can use Perl's internal functions to identify/monitor
> the process and stop/kill them?
> I realize there's Proc::ProcessTable .pm for this, but I want my
> distribution to include just the Perl script and have it do it all.
> I'm working on Solaris, Perl 5.6.
> 
> Thanks for your time,
> Prabh

If you dont want to use ProcessTable.pm, then in linux I use the output from
ps:

sub killem {
        my($pid,$tname,$etime,$cmd,$emin,$ehour,$background);

        for (split '\n', qx(ps -u $> -o pid,tname,etime,cmd --no-headers)) {
                ($pid, $tname, $etime,$cmd) = unpack "a5 x a11 x a8 x a200"
$_;
                #print "$_\n";
                $etime =~ /((\d*):)?(\d*):(\d*)$/;
                $ehour  = $2;
                $emin   = $3;
                $background=/\?/;
                next if $pid==$$;

                if ($ehour>12 || ((!/sshd/)&&$background&&($ehour>=1|
$emin>10))) {
                        log('Killing '.$_);
                        kill 9,$pid;
                }
        }
}

gtoomey


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

Date: 31 Jan 2005 08:02:11 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Perl loops should use break, not last
Message-Id: <slrncvrpg2.a9.abigail@alexandra.abigail.nl>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCLXX
September MCMXCIII in <URL:news:ctjr8m$pr2$1@mamenchi.zrz.TU-Berlin.DE>:
[]  Abigail  <abigail@abigail.nl> wrote in comp.lang.perl.misc:
[] > Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCLXX
[] > September MCMXCIII in <URL:news:ctjbm6$h4n$2@mamenchi.zrz.TU-Berlin.DE>:
[] > ??  
[] > ??  Early compiler designs (Pascal, C, Algol) tended to ignore this ambiguity.
[] > ??  Later ones (Modula2, Perl, not sure about Algol68) decided to enforce
[] > ??  delimiters for this very reason.  That was progress, there's no reason
[] > ??  to go back behind it.
[] > 
[] > 
[] > Algol 68 didn't use delimiters around then/else blocks. Algol 68 uses
[] > if ... then ... else ... fi which solves the problem in a different way.
[]  
[]  Oh, right, thanks for reminding me.
[]  
[]              od;
[]          fi;
[]      fi;
[]  
[]  Maybe that's why the language never took off :)

I dunno. I prefer it that way over braces. The shell uses that as well.



Abigail
-- 
use   lib sub {($\) = split /\./ => pop; print $"};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";


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

Date: 31 Jan 2005 08:04:24 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Perl loops should use break, not last
Message-Id: <slrncvrpk8.a9.abigail@alexandra.abigail.nl>

Jeremy Morton (ask@me.com) wrote on MMMMCLXXI September MCMXCIII in
<URL:news:41fd785d$0$4566$fa0fcedb@news.zen.co.uk>:
||  "Abigail" <abigail@abigail.nl> wrote in message 
||  news:slrncvqo37.a9.abigail@alexandra.abigail.nl...
|| > Jeremy Morton (ask@me.com) wrote on MMMMCLXX September MCMXCIII in
|| > <URL:news:41fd39a4$0$26027$fa0fcedb@news.zen.co.uk>:
|| > %%
|| > %% > One of the reasons 'last' isn't called 'break' is that 'last' isn't
|| > %% > the same as 'break'. 'break' breaks the current loop - while 'last'
|| > %% > takes an optional argument, indicating the top level loop that will
|| > %% > be exited.
|| > %%
|| > %%  Hang on, are you saying 'break' has a meaning in Perl?
|| >
|| > No, I did not.
|| >
||  
||  The what did you mean when you said 'last' isn't the same as break?  AFAICT,
||  Perl's 'last' is identical to C and other languages's 'break', assuming that
||  break can take an optional argument specifying which level of block to break
||  out of (which often, it can).


Well, if you assume the difference I point out is there, they are 
equivalent. But as long as there is a difference, they aren't the 
same, are they?


Abigail
-- 
BEGIN {$^H {join "" => ("a" .. "z") [8, 13, 19, 4, 6, 4, 17]} = sub
           {["", "Just ", "another ", "Perl ", "Hacker"] -> [shift]};
       $^H = hex join "" => reverse map {int ($_ / 2)} 0 .. 4}
print 1, 2, 3, 4, "\n";


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

Date: 31 Jan 2005 09:50:02 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Perl loops should use break, not last
Message-Id: <yzdfz0i6kzp.fsf@invalid.net>


"Alan J. Flavell" <flavell@ph.gla.ac.uk> writes:
> On Sat, 29 Jan 2005, A. Sinan Unur wrote:
> 
> > "Jeremy Morton" <ask@me.com> wrote in
> > > semantically more accurate to say 'break' - 
> > 
> > I have a sneaking suspicion that you are trolling, 
> 
> I think you're being rather uncharitable.  As far as I recall, "break" 
> /was/ the term used in BCPL for effectively the same purpose:
> 
> | causes execution to be resumed at the point just after
> | the smallest textually enclosing loop command
> 
> it says in the old manual.
> 
> But the Perl usage is now well established, and the other arguments
> on this thread are well taken.  I doubt there's anything to be gained
> by trying to change the Perl usage now, and I don't see any net 
> benefit in it.

The absence of "break" in Perl is pointed out in "perltrap.pod". What is
not pointed out explicitly there is that if you mistakenly write "break"
when you should have written "last", and also do not use "use warnings;",
no hint of anything wrong will be given when the code is executed - the
"break" will be a no-op. It took me a little while to find this error
someone else had made in one of the first Perl scripts I had to debug.
(I didn't know about "use warnings;" at the time.)


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

Date: 31 Jan 2005 03:05:49 -0800
From: jbmorla@tiscali.fr (Jean-Benoit MORLA)
Subject: Perl newbie -  getting "system()" to return
Message-Id: <ea6556b4.0501310305.6dfca3e9@posting.google.com>

Hi,

I have to run 4 Windows XP Pro executables sequentially from a script.
Each executable has to be started after its predecessor.
I tried:

system( executable1 );
system( executable2 );

But the Command windows hangs until I kill the process from task
manager.
The second line never gets executed.
Also the script must not skip directly to the second line because each
executable needs the previous one to start up.
Is there another command in Perl than system()?
Many thanks


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

Date: Mon, 31 Jan 2005 11:15:31 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl newbie -  getting "system()" to return
Message-Id: <Xns95EF3FB5BA6A3asu1cornelledu@127.0.0.1>

jbmorla@tiscali.fr (Jean-Benoit MORLA) wrote in 
news:ea6556b4.0501310305.6dfca3e9@posting.google.com:

> I have to run 4 Windows XP Pro executables sequentially from a script.
> Each executable has to be started after its predecessor.
> I tried:
> 
> system( executable1 );
> system( executable2 );
> 
> But the Command windows hangs until I kill the process from task
> manager.
> The second line never gets executed.
> Also the script must not skip directly to the second line because each
> executable needs the previous one to start up.
> Is there another command in Perl than system()?
> Many thanks

If I am reading correctly, you are saying: I want to wait until 
executable1 is finished before I launch executable2 but I don't want to 
wait until executable1 is finished before launching executable2.

system waits until the external program it launches terminates. Maybe 
you should look into why executable1 is not terminating.

On the other hand, if you would like system to return immediately after 
launching executable1, you can launch it with start.

Note that this is not really a Perl question but rather a Windows 
question.

Please read the posting guidelines for this group to learn how you can 
others help you.

Sinan.


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

Date: Mon, 31 Jan 2005 14:00:52 GMT
From: "George" <georgekinley@hotmail.com>
Subject: Re: Perl newbie - getting "system()" to return
Message-Id: <xn0dxww194mdipg001@news.europe.nokia.com>

Jean-Benoit MORLA wrote:

> Hi,
> 
> I have to run 4 Windows XP Pro executables sequentially from a script.
> Each executable has to be started after its predecessor.
> I tried:
> 
> system( executable1 );
> system( executable2 );
> 
> But the Command windows hangs until I kill the process from task
> manager.
> The second line never gets executed.
> Also the script must not skip directly to the second line because each
> executable needs the previous one to start up.
> Is there another command in Perl than system()?
> Many thanks

try geting the result,
@result=`executable1`


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

Date: 31 Jan 2005 02:20:28 -0800
From: s99999999s2003@yahoo.com (mike)
Subject: printing PDF in win32
Message-Id: <dfd17ef4.0501310220.632d20e1@posting.google.com>

hi

i am working in Win32 env.
I have some pdf files to print to a network printer using a perl script
I have searched CPAN but am not sure which modules can i use to do that.

(eg. there are some modules such as Win32::Printer and Printer etc..)

can someone advise me on this?
thanks...


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

Date: Mon, 31 Jan 2005 12:39:08 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: printing PDF in win32
Message-Id: <ctl8jo$9li$1@sun3.bham.ac.uk>

mike wrote:
>
> i am working in Win32 env.
> I have some pdf files to print to a network printer using a perl script
> I have searched CPAN but am not sure which modules can i use to do that.
> 
> (eg. there are some modules such as Win32::Printer and Printer etc..)
> 
> can someone advise me on this?

As far as I know what I said back in 2003 ago still holds, i.e. to print 
PDF on Windows other than manually through the reader you need a full 
(non-free) version of Acrobat.

http://groups-beta.google.com/group/comp.lang.perl.misc/msg/2e51c2a5f4dba402





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

Date: Mon, 31 Jan 2005 14:54:17 +0100
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <sppNOSPAM@libello.com>
Subject: Re: printing PDF in win32
Message-Id: <41fe3889$0$4789$626a14ce@news.free.fr>

mike wrote:

> hi
> 
> i am working in Win32 env.
> I have some pdf files to print to a network printer using a perl script
> I have searched CPAN but am not sure which modules can i use to do that.
> 
> (eg. there are some modules such as Win32::Printer and Printer etc..)
> 
> can someone advise me on this?
> thanks...
Hi,

you can use ghostscript

cheers.

Sébastien

-- 
[ retirer NOSPAM pour répondre directement
 remove NOSPAM to reply directly ]


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

Date: Mon, 31 Jan 2005 14:48:55 +0100
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <sppNOSPAM@libello.com>
Subject: recursive function and hashe
Message-Id: <41fe3748$0$4789$626a14ce@news.free.fr>

I all,

Here is my problem,

I'd like to store in a hash table those numbers like that:
(123, 124, 13, 145, 2, 25)

%number = (
        "1" => {
                "2" => {
                        "3" => {
                                "value" => "OK"
                        },
                        "4" => {
                                "value" => "OK"
                        },
                },
                "3" => {
                        "value" => "OK"
                },
                "4" => {
                        "5" => {
                                "value" => "OK"
                        }
                }
        },
        "2" => {
                "value" => "OK",
                "5" => {
                        "value" => "OK"
                }
        }
);

I think I need to use recursive function, but I did know how, I'm not
familiar with passing references.

If someone can help me.

Thanks in advance.

Sébastien
-- 
[ retirer NOSPAM pour répondre directement
 remove NOSPAM to reply directly ]


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

Date: Mon, 31 Jan 2005 14:45:50 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: recursive function and hashe
Message-Id: <pan.2005.01.31.13.45.41.137070@dunkelheit.at>

Sébastien Cottalorda wrote:

> I think I need to use recursive function, but I did know how, I'm not
> familiar with passing references.

Yep. That would be one way to do it. Some other way I can imagine includes
two Loops.
 
> If someone can help me.

Sure, many here in do. But, you see, there are /many/ people hanging at
problems, wanting help. So it would be much more useful for us (because it
is easier) and you (because more ppl are going to read it, and much more
are going to answer it) if you try out yourself and ask for help with the
problems you're running in.


p

-- 
http://www.dunkelheit.at/

Ordinary morality is only for ordinary people.
                       -- Aleister Crowley



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

Date: Mon, 31 Jan 2005 15:02:47 +0100
From: Hendrik Maryns <hendrik_maryns@despammed.com>
Subject: regexp inside <> + typos in perldoc
Message-Id: <i_SdnYXQAqMbp2PcRVnyjA@scarlet.biz>

Hi,

I know it is possible to read in the current dir with @list=<*.*> or 
even <*>.  Now, I want to read all the current files, except for the 
 .pl-files.  I tried <*.[^(pl)]*>, but this gave me the pl files alone!. 
  How do regexps inside <> work?  Or do these follow the syntax of my 
command line (WinXP, I'm afraid)?  And, related: how can I get the 
current directory?

Apart from this, I sometimes find minor typos in the docs.  Where can I 
report those?  Via perlbug seems a bit too strong to me...
(e.g.: in perlretut, line 15 of "Using character classes": 'away' should 
be 'a way')

Cheers, Hendrik


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

Date: Mon, 31 Jan 2005 09:32:53 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Replace text inside html tags?
Message-Id: <futrv05tcftruvfadcrc8r0ah2e481qmu1@4ax.com>

A. Sinan Unur wrote:

>I had never used HTML::TokeParser::Simple, so I gave that a shot:

>my $p = HTML::TokeParser::Simple->new(string => $html);
>
>my $in_font_tag;
>
>while(my $token = $p->get_token) {
>    if($token->is_start_tag('font')) {
>        print $token->as_is;
>        $in_font_tag = 1;
>        next;
>    }
>    if($token->is_end_tag('font')) {
>        print $token->as_is;
>        $in_font_tag = 0;
>        next;
>    }
>    if($in_font_tag and $token->is_text) {
>        my $text = $token->as_is;
>        $text =~ s/HI/BYE/g;
>        print $text;
>        next;
>    }
>    print $token->as_is;
>}

I like to use ".." in code with this kind of functionality. This shows
IMO an aspect where a tokeparser approach is vastly superior to raw
usage of HTML::Parser.

    while(my $token = $p->get_token) {
        if($token->is_start_tag('font') .. $token->is_end_tag('font')) {
            if($token->is_text) {
                my $text = $token->as_is;
                $text =~ s/HI/BYE/g;
                print $text;
                next;
            }
        }
        print $token->as_is;
    }


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


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