[24707] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6864 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 11:06:03 2004

Date: Fri, 13 Aug 2004 08:05:08 -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, 13 Aug 2004     Volume: 10 Number: 6864

Today's topics:
    Re: .pl -> .exe not so obvious ... <simecom.hvoisin@thales-bm.com>
    Re: Counting text area <jurgenex@hotmail.com>
    Re: Counting text area <wayne.sargent@tiscali.fr>
    Re: Counting text area <noreply@gunnar.cc>
    Re: Counting text area <noreply@gunnar.cc>
    Re: freeing the memory used by a hash <Joe.Smith@inwap.com>
    Re: freeing the memory used by a hash (Anno Siegel)
    Re: How to catch CTRL-C in Windows NT cmd.exe??? <gifford@umich.edu>
        newbie question-----where is wrong.(only 19 lines code) <artgh@hotmail.com>
    Re: newbie question-----where is wrong.(only 19 lines c <thundergnat@hotmail.com>
    Re: Parsing html by XML::libXML <kuujinbo@hotmail.com>
        Parsing Visual Studio project files <a_ominous.rover@yahoo.com>
    Re: passing param('something') through a function <me@example.com>
    Re: passing param('something') through a function <me@example.com>
    Re: Perl - Parse UNC Path in a string variable (Anno Siegel)
    Re: Perl - Parse UNC Path in a string variable <Joe.Smith@inwap.com>
        perl documentation in unix info format <pikpus@wp.pl>
    Re: Program slows as I run it <patrice.auffret@intranode.com>
    Re: Reset <> without having it fail once? (Hunter Johnson)
    Re: Reset <> without having it fail once? (Greg Bacon)
    Re: Reset <> without having it fail once? (Peter Scott)
    Re: Splitting paragraph into array. <gnari@simnet.is>
    Re: Splitting paragraph into array. <mr@sandman.net>
    Re: testing without shell access <Joe.Smith@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 13 Aug 2004 15:05:27 +0200
From: TBM <simecom.hvoisin@thales-bm.com>
Subject: Re: .pl -> .exe not so obvious ...
Message-Id: <cfieb1$ka2$1@news-reader5.wanadoo.fr>

PAR is just so great, it worked perfectly and easily. Thank you for the 
advice :D


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

Date: Fri, 13 Aug 2004 11:34:15 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Counting text area
Message-Id: <XG1Tc.17304$EQ5.4569@nwrddc03.gnilink.net>

Davidd Sargent wrote:
> I have a textarea which the user types there subdomain in to and then
> click submit.
> What I want is on the results page for it to count the number of
> subdomains (each domain will be seperated by \n (a newline)).

Perl doesn't have text areas, submit clicks, or pages.
Trying to rephrase your question to make sure I guessed right on what you
were looking for:

Given a scalar containing muli-line text (separated by standard \n) how can
I determine how many lines of text the scalar contains?

use strict; use warnings;
my $foo = "asdf\nlkjh\nfoo\nbar\n\n";
my $newlines = () = $foo =~/\n/g;
print $newlines;

Further details see "perldoc perlop", section "Regexp Quote-Like Operators",
in particular the "g" modifier.

jue




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

Date: Fri, 13 Aug 2004 15:27:04 +0200
From: "Davidd Sargent" <wayne.sargent@tiscali.fr>
Subject: Re: Counting text area
Message-Id: <cfifib$kvu$1@news.tiscali.fr>

My Code
Sorry I'm a beginner.

$tempvar = $in{'packageID'};
$line = "\n";
@newtextareaarray = split($tempvar,$line);
$count ="0";
foreach $line (@newtextareaarray) {
$count++;

}


print qq|Here : $count|;


Thanks

Dave

"Jürgen Exner" <jurgenex@hotmail.com> a écrit dans le message de
news:XG1Tc.17304$EQ5.4569@nwrddc03.gnilink.net...
> Davidd Sargent wrote:
> > I have a textarea which the user types there subdomain in to and then
> > click submit.
> > What I want is on the results page for it to count the number of
> > subdomains (each domain will be seperated by \n (a newline)).
>
> Perl doesn't have text areas, submit clicks, or pages.
> Trying to rephrase your question to make sure I guessed right on what you
> were looking for:
>
> Given a scalar containing muli-line text (separated by standard \n) how
can
> I determine how many lines of text the scalar contains?
>
> use strict; use warnings;
> my $foo = "asdf\nlkjh\nfoo\nbar\n\n";
> my $newlines = () = $foo =~/\n/g;
> print $newlines;
>
> Further details see "perldoc perlop", section "Regexp Quote-Like
Operators",
> in particular the "g" modifier.
>
> jue
>
>




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

Date: Fri, 13 Aug 2004 16:02:49 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Counting text area
Message-Id: <2o406dF6oficU1@uni-berlin.de>

Davidd Sargent wrote:
>> Davidd Sargent wrote:
>>> I have a textarea which the user types there subdomain in to
>>> and then click submit.
>>> What I want is on the results page for it to count the number
>>> of subdomains (each domain will be seperated by \n (a
>>> newline)).
> 
> $tempvar = $in{'packageID'};
> $line = "\n";
> @newtextareaarray = split($tempvar,$line);
> $count ="0";
> foreach $line (@newtextareaarray) {
> $count++;
> 
> }

You should look up and read about the split() function in the docs:

     perldoc -f split

Also, you don't need all those temporary variables. This should do
what you want:

     my $count = 0;
     $count ++ for split /\n/, $in{packageID};

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Fri, 13 Aug 2004 16:16:40 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Counting text area
Message-Id: <2o410cF6icjpU1@uni-berlin.de>

Gunnar Hjalmarsson wrote:
> This should do what you want:
> 
>     my $count = 0;
>     $count ++ for split /\n/, $in{packageID};

I.e. as long as you trust the users to only type subdomains, and to 
put one subdomain per line...

Have you thought about how to tell your program how it should 
recognize a subdomain?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Fri, 13 Aug 2004 12:06:49 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: freeing the memory used by a hash
Message-Id: <t92Tc.248078$%_6.128130@attbi_s01>

ravi wrote:

> which is a best way to free the all the memory used by a hash explain
> in the context of complicated data structures like hash of hashes
> 
> undef %hash;
> delete %hash;
> %hash =();

The middle one is incomplete; the delete() function is used on
individual entries in the hash.  To get them all, you would need
   delete $hash{$_} for keys %hash;

All of them mark the memory used by the hash as being available for
reuse.  Perl will use it for new variables when it needs it.
It will not return memory back to the OS.
	-Joe


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

Date: 13 Aug 2004 12:32:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: freeing the memory used by a hash
Message-Id: <cficd0$oks$3@mamenchi.zrz.TU-Berlin.DE>

Joe Smith  <Joe.Smith@inwap.com> wrote in comp.lang.perl.misc:
> ravi wrote:
> 
> > which is a best way to free the all the memory used by a hash explain
> > in the context of complicated data structures like hash of hashes
> > 
> > undef %hash;
> > delete %hash;
> > %hash =();
> 
> The middle one is incomplete; the delete() function is used on
> individual entries in the hash.  To get them all, you would need
>    delete $hash{$_} for keys %hash;

 ...or a slice:

    delete @hash{ keys %hash};

Anno


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

Date: 13 Aug 2004 10:58:41 -0400
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: How to catch CTRL-C in Windows NT cmd.exe???
Message-Id: <qsz3c2rulsu.fsf@asteroids.gpcc.itd.umich.edu>

solo11051970@yahoo.ca (Solo) writes:

> I wrote the following code just to test the catch of Ctrl-C:
> ---------------
> 
> {
> 
>   $SIG{'INT'} = \&cmd1;

Try using $SIG{BREAK} instead.  I recall that working for me, though I
don't recall where I read it.

----ScottG.


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

Date: Fri, 13 Aug 2004 21:27:23 +0800
From: Facco Eloelo <artgh@hotmail.com>
Subject: newbie question-----where is wrong.(only 19 lines code)
Message-Id: <411cbe64.3564633@news.individual.net>

I want to get the "inputrate" and the "outputrate" from a router's log(using
show command).and the outputfile looks like:
1,1000,0
2,3000,2000
 ...

It should be very easy.But the code doesn't work.can anybody help me?thanks in
advance.


#########code begin##################
#!/usr/bin/perl
$infile='d:\routertest.log';
$outfile='d:\output';
open(IN, "< $infile") or die "Couldn't open $infile for reading: $!";
open(OUT, "> $outfile") or die "Couldn't open $outfile for reading: $!";
@line=<IN>;
$num=@line;
$count=1;
for($i=0;$i<$num;$i++)
{

	if(chomp($line[$i]) eq "r1-b-sdnn>show int fa1/1/0")
	{
		@inputrate=split(/''/,$line[$i+14]);
		@outrate=split(/''/,$line[$i+1]);
		print OUT "$count,$inputrate[4],$outputrate[4]";
		$count++;
	}
}
##############code end##########################



################d:\routertest.log##############
r1-b-sdnn>show int fa1/1/0
FastEthernet1/1/0 is up, line protocol is up 
  Hardware is cyBus FastEthernet Interface, address is 22211.d126.2898 (bia
0072.7176.2928)
  Description: to-580-p
  Internet address is 61.179.255.202/30
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 1/75, 0 drops, 54 flushes
  5 minute input rate 1000 bits/sec, 1 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     31321654 packets input, 3593026896 bytes, 0 no buffer
     Received 13476682 broadcasts, 1 runts, 0 giants, 0 throttles
     31 input errors, 0 CRC, 0 frame, 0 overrun, 31 ignored
     0 watchdog, 0 multicast
     0 input packets with dribble condition detected
     25753387 packets output, 3750041951 bytes, 0 underruns
     0 output errors, 0 collisions, 6 interface resets
     0 babbles, 0 late collision, 0 deferred
     10 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
r1-b-sdnn>show int fa1/1/0
FastEthernet1/1/0 is up, line protocol is up 
  Hardware is cyBus FastEthernet Interface, address is 0902.7d16.8828 (bia
0102.7616.2228)
  Description: to-580-p
  Internet address is 35.179.255.202/30
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 2/75, 0 drops, 54 flushes
  5 minute input rate 3000 bits/sec, 3 packets/sec
  5 minute output rate 2000 bits/sec, 3 packets/sec
     31321698 packets input, 3593036917 bytes, 0 no buffer
     Received 13476696 broadcasts, 1 runts, 0 giants, 0 throttles
     31 input errors, 0 CRC, 0 frame, 0 overrun, 31 ignored
     0 watchdog, 0 multicast
     0 input packets with dribble condition detected
     25753446 packets output, 3750058041 bytes, 0 underruns
     0 output errors, 0 collisions, 6 interface resets
     0 babbles, 0 late collision, 0 deferred
     10 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
r1-b-sdnn>show int fa1/1/0
FastEthernet1/1/0 is up, line protocol is up 
  Hardware is cyBus FastEthernet Interface, address is 0002.7016.2028 (bia
1002.0916.2028)
  Description: to-580-p
  Internet address is 78.179.255.202/30
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, rely 255/255, load 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, 100BaseTX/FX
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Queueing strategy: fifo
  Output queue 0/40, 0 drops; input queue 3/75, 0 drops, 54 flushes
  5 minute input rate 3000 bits/sec, 5 packets/sec
  5 minute output rate 3000 bits/sec, 5 packets/sec
     31321765 packets input, 3593045770 bytes, 0 no buffer
     Received 13476706 broadcasts, 1 runts, 0 giants, 0 throttles
     31 input errors, 0 CRC, 0 frame, 0 overrun, 31 ignored
     0 watchdog, 0 multicast
     0 input packets with dribble condition detected
     25753528 packets output, 3750073394 bytes, 0 underruns
     0 output errors, 0 collisions, 6 interface resets
     0 babbles, 0 late collision, 0 deferred
     10 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
#####################code end###############################


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

Date: Fri, 13 Aug 2004 10:10:11 -0400
From: thundergnat <thundergnat@hotmail.com>
Subject: Re: newbie question-----where is wrong.(only 19 lines code)
Message-Id: <411ccbbb$0$5918$61fed72c@news.rcn.com>

Facco Eloelo wrote:
> I want to get the "inputrate" and the "outputrate" from a router's log(using
> show command).and the outputfile looks like:
> 1,1000,0
> 2,3000,2000
> ...
> 
> It should be very easy.But the code doesn't work.can anybody help me?thanks in
> advance.
> 


How bout somthing like:


#!/usr/bin/perl

use Warnings;
use Strict;

my $infile='d:\routertest.log';
my $outfile='d:\output';
my $count;

open(my $IN, "< $infile") or die "Couldn't open $infile for reading: $!";
open(my $OUT, "> $outfile") or die "Couldn't open $outfile for reading: $!";
while (<$IN>) {
     if ( m/input rate (\d+)/ ){
         $count++;
	print $OUT $count,',',$1,',';
     }
     if ( m/output rate (\d+)/ ){
         print $OUT "$1\n";
     }
}


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

Date: Fri, 13 Aug 2004 20:01:24 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Parsing html by XML::libXML
Message-Id: <2o3lcaF6i1n2U1@uni-berlin.de>

John7481 wrote:
> Hello everybody,
> 
> A database project is targeted to use a perl script to parse the html
> file and picking few items from html file, it will insert those items
> into database.
> 
> Could somebody explain their ideas or real experiences to do such
> parsing job using libXML?
> 
> Thanks in advance
> AR

These articles should help get you started:

http://www.stonehenge.com/merlyn/PerlJournal/col02.html
http://www.stonehenge.com/merlyn/PerlJournal/col03.html

The articles are titled 'Cleaning up your HTML', but its the same 
concept, identifying tags/attributes.

After you initialize the parser object, call its recover() method if 
you're not sure whether you're dealing with well-formed HTML.

HTH - keith


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

Date: Fri, 13 Aug 2004 12:09:22 +0100
From: Ann Ominous <a_ominous.rover@yahoo.com>
Subject: Parsing Visual Studio project files
Message-Id: <411CA161.4C34AB04@yahoo.com>

Hi
I've got a Visual Studio workspace with 100 project files.  I have to
document the compiler flags used in each project and would like to do
this in Perl.
There are several possible build configurations in the project files.
I'm only interested in the Win32 Release config.  I want to read all the
CPP lines in the relevant config.  I've not been able to extract the
relevant lines.  I can get the starting line of each block, but am not
pushing the CPP flags into the array.  I think my problem lies in using
next /last.
Here's my code and some data from one project.
TIA for any help.
-ao-


__CODE__
#!/usr/local/bin/perl -w

#use strict;

# open the Build All worksapce, read all the projects and print out the
# compiler flags used

$workspace = $ARGV[1];
$workspace = "BuildAll.dsw";


open ( BUILDALL, $workspace )
    || die "Cannot open $workspace: $!";

while( <BUILDALL> )
{
    if ( /^Project.*=\"(.*)\"/ )
    {
 @words = split( /\"/, $_ );
 $projects{ $words[1] } = $words[3];
 $num_projects++;
    }
}
close( BUILDALL )
    || die "Cannot close BuildAll\n";

print "Workspace $workspace has $num_projects projects\n\n";


# now go through each file and look for the "Win32 Release"
configuration

foreach $p (sort keys(%projects) )
{
    print $p, "\t$projects{ $p }", "\n" ;
    open( PROJECT, $projects{ $p } )
 || die "Cannot open project $p\n";

    $done = 0;
    #while( ! $done && <PROJECT> )
    while( <PROJECT> )
    {
 #next if /^$/;
 @cpp_flags = ();
     #if( /(CFG).*Win32 Release/ )

     if( /\(CFG\).*Win32 Release"$/ )
 {
     # once we get the correct config read until we get next IF block or
ENDIF
         while( <PROJECT> )
     {
  #print "\t$_";

  #cpp_flags = $_ if /CPP/;

  if ( /CPP/ )
  {
      push( @cpp_flags, $_);
      #$cpp_flags = $_;
      #print $cpp_flags;
  }

  # quit when we get to next IF stagement
  if ( /IF?/ )
  {
      $done = 1;
      last;
  }
  #next;
     }
 }
 $done && print "@cpp_flags";
    }

    close( PROJECT )
 || die "Cannot close project $p\n";
}



__DSPFILE_SYNTAX__

# Microsoft Developer Studio Project File - Name="MyProject" - Package
Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Static Library" 0x0104

CFG=MyProject - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using
NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "MyProject.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "MyProject.mak" CFG="MyProject - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "MyProject - Win32 Release" (based on "Win32 (x86) Static
Library")
!MESSAGE "MyProject - Win32 Debug" (based on "Win32 (x86) Static
Library")
!MESSAGE

# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "MyProject"
# PROP Scc_LocalPath "."
CPP=cl.exe
RSC=rc.exe

!IF  "$(CFG)" == "MyProject - Win32 Release"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "MyProject___Win32_Release"
# PROP BASE Intermediate_Dir "MyProject___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../R_NT"
# PROP Intermediate_Dir "R_NT"
# PROP Target_Dir ""
MTL=midl.exe
LINK32=link.exe
# ADD BASE CPP /nologo /MD /W3 /GX /Z7 /O2 /I "..\SDA" /I "..\\" /I
"..\..\..\..\ProjectB\dev" /D "WIN32" /D "_WINDOWS" /D "MyProject_LIB"
/D "_UNICODE" /YX /FD /c
# SUBTRACT BASE CPP /Fr
# ADD CPP /nologo /MD /W3 /GX /I "../" /I "../../" /I
"../../../../ProjectA/Includes/" /I "../SDA" /I "../MyProject" /D
"WIN32" /D "_WINDOWS" /D "MyProject_LIB" /D "UNICODE" /D "_UNICODE" /YX
/FD /c
# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo

!ELSEIF  "$(CFG)" == "MyProject - Win32 Debug"




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

Date: Fri, 13 Aug 2004 10:29:14 -0400
From: steve_f <me@example.com>
Subject: Re: passing param('something') through a function
Message-Id: <nvjph0h7h57v6i8ff2lehmcl92rg6umgd1@4ax.com>

On Wed, 11 Aug 2004 00:28:29 +0100, "Alan J. Flavell" <flavell@ph.gla.ac.uk> wrote:

>On Tue, 10 Aug 2004, steve_f wrote:
>
>> So....basically config type options are attached to the 
>> query...well...maybe I really could just use a hidden tag instead. I 
>> think I was thinking it was fun to do both, but I guess I could make 
>> it easier for myself.
>
>You've still got the PATH_INFO available (for any server that supports 
>the CGI specification - which AIUI excludes MS's IIS from 
>consideration).
>
>But this is a CGI issue, rather than a Perl language matter.  CGI.pm 
>certainly supports that; but the underlying technology would be better 
>discussed, if need be, on an appropriate CGI group, viz. 
>comp.infosystems.www.authoring.cgi (beware the automoderation bot).
>
>hope that helps

yes, thank you. My solution was to use:

(my $query = $ENV{QUERY_STRING}) =~ s/boxes=//;

about posting in other groups, I really should get around
and look at what else is out there.


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

Date: Fri, 13 Aug 2004 10:34:40 -0400
From: steve_f <me@example.com>
Subject: Re: passing param('something') through a function
Message-Id: <cbkph05u60rfdd9bucpet9j6986e2a4ntv@4ax.com>

On Wed, 11 Aug 2004 11:24:12 +0100, "Richard Gration" <richard@zync.co.uk> wrote:

>In article <C9cSc.10570$nx2.8410@newsread2.news.atl.earthlink.net>, "Bill
>Segraves" <segraves_f13@mindspring.com> wrote:
>> "steve_f" <me@example.com> wrote in message
>> news:r8fih0hh10m31icsvvr837cb645eu8dkdk@4ax.com...
>>> can CGI.pm use both POST and GET together?
>> Yes. See the documentation, "MIXING POST AND URL PARAMETERS"  --
>
>And if you want a little giggle, search CGI.pm for the word 'cake' ;-)
>
>R

ah haha...very funny!


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

Date: 13 Aug 2004 10:22:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl - Parse UNC Path in a string variable
Message-Id: <cfi4op$oks$2@mamenchi.zrz.TU-Berlin.DE>

Kevin Joseph <kejoseph@hotmail.com> wrote in comp.lang.perl.misc:
> Is this a Perl newsgroup or a newsgroup for someone from KinderGarden
> or it is that you are trying to market some web page for dummies ? I
> think I will just ignore your comment and wait for others to answer.

Good luck then.

Anno


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

Date: Fri, 13 Aug 2004 11:56:07 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Perl - Parse UNC Path in a string variable
Message-Id: <r%1Tc.142867$eM2.39972@attbi_s51>

Kevin Joseph wrote:

> Is this a Perl newsgroup or a newsgroup for someone from KinderGarden
> or it is that you are trying to market some web page for dummies ?

It was a serious request for more information in order to help you
solve your problem.

>>> I have the logic to convert \ to \\ which is why the former works
>>> (\\server\share_name\filename).

Could you show us your logic?  It might need a bit of a rework.

>>> I tried escaping the $ (using \$) but
>>> that did not work. I have tried various permutations and combinations
>>> thus far and as a last option am sending my request to this newsgroup.

Could you show us which permutations and combinations you've tried so far?

> Kindly provide some useful information then. You indicate that you 
> 'parse' the variable, that you have the 'logic' to convert \ to \\ etc 
> but never show code. We are not mind readers here.

In other words, show us the actual code you've tried so far.
	-Joe


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

Date: 13 Aug 2004 13:20:51 GMT
From: matthew <pikpus@wp.pl>
Subject: perl documentation in unix info format
Message-Id: <slrnchpg1e.4dg.pikpus@localhost.localdomain>

Hallo
Do You where can I find such documentation in info format ?

Thanks in advance
Greetings
-matthew


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

Date: Fri, 13 Aug 2004 12:43:31 +0200
From: Patrice Auffret <patrice.auffret@intranode.com>
Subject: Re: Program slows as I run it
Message-Id: <20040813124331.0ab42f89.patrice.auffret@intranode.com>

On Mon, 9 Aug 2004 10:57:15 -0700
"Daniel Miller" <dgmiller@u.washington.edu> wrote:

> Thanks for the input, even with the lack of information I think most of
> you
> guessed correctly. Turns out that as each record was processed I was
> saving
> it in an array and then reitterating over that array with the next record
> (to make sure there were no duplicates)  explaining why it was slowing
> exponentially as the second array grew in size. Anyway, thanks for you
> thoughts. I'll have to get more comfortable with hashes.


  If you want to have arrays with unique elements:
  use Tie::Array::Unique;


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

Date: 13 Aug 2004 05:12:17 -0700
From: hunter@hunterandlori.com (Hunter Johnson)
Subject: Re: Reset <> without having it fail once?
Message-Id: <19afcf24.0408130412.3664183b@posting.google.com>

gbacon@hiwaay.net (Greg Bacon) wrote in message news:<10hn01c4o4um629@corp.supernews.com>...
> In article <19afcf24.0408120443.6cbe88f@posting.google.com>,
>     Hunter Johnson <hunter@hunterandlori.com> wrote:
> 
> : I was
> : curious if there was Another Way To Do It.  It seemed like something
> : that could be done, but the I only found pointers to having <> fail
> : once in the docs.
> 
> Use exec!

[code snipped]

Say, that's slick, and no (explicit) close.  Thanks!

Hunter
--
http://www.hunterandlori.com


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

Date: Fri, 13 Aug 2004 12:32:22 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Reset <> without having it fail once?
Message-Id: <10hpd6m7socf531@corp.supernews.com>

In article <10hn01c4o4um629@corp.supernews.com>,
    Greg Bacon <gbacon@hiwaay.net> wrote:

: print if /\b$id\b/;

That should have a /o:

    print if /\b$id\b/o;

Greg
-- 
That's kinda scary powerful.  I'm not sure I want to document that...
["Too late!" whispers Evil Damian.]
    -- Larry Wall, Apocalypse 6


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

Date: Fri, 13 Aug 2004 13:12:37 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Reset <> without having it fail once?
Message-Id: <973Tc.93661$M95.70116@pd7tw1no>

In article <10hn01c4o4um629@corp.supernews.com>,
 gbacon@hiwaay.net (Greg Bacon) writes:
>Use exec!

Nice solution.

>    $ cat try
>    #! /usr/local/bin/perl
>
>    use warnings;
>    use strict;
>
>    sub usage { "Usage: $0 [<term> | --id=<id>] file..\n" }
>
>    sub find_id {
>        my $who = shift;
>
>        my @saved = @ARGV;
>
>        my $pat = qr/\Q$who\E;ID=(.*)/o;
>        while (<>) {
>            next unless /$pat/;
>
>            no warnings 'exec';

The line above should not be necessary; the only statement following
exec in the control flow is a die.

>            exec $0, "--id=$1", @saved;
>            die "$0: exec: $!";
>        }
>
>        die "$0: no ID found!\n";
>    }
[snip]

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/


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

Date: Fri, 13 Aug 2004 10:42:58 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Splitting paragraph into array.
Message-Id: <cfi5ri$c1k$1@news.simnet.is>

"Sandman" <mr@sandman.net> wrote in message
news:mr-9AA95B.11563013082004@individual.net...

[balanced tags]

is the code html encoded, or can this happen?:


  foo

  <code>
    $a = "</code>";

    print "$a\n<code>";

    print "\n";
  </code>

  bar

  <code>
    $b = "</code>";

    print "$b\n<code>";

    print "\n";
  </code>

  fubar


gnari






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

Date: Fri, 13 Aug 2004 13:20:41 +0200
From: Sandman <mr@sandman.net>
Subject: Re: Splitting paragraph into array.
Message-Id: <mr-AC0F59.13204113082004@individual.net>

In article <cfi5ri$c1k$1@news.simnet.is>, "gnari" <gnari@simnet.is> wrote:

> "Sandman" <mr@sandman.net> wrote in message
> news:mr-9AA95B.11563013082004@individual.net...
> 
> [balanced tags]
> 
> is the code html encoded, or can this happen?:
> 
> 
>   foo
> 
>   <code>
>     $a = "</code>";
> 
>     print "$a\n<code>";
> 
>     print "\n";
>   </code>
> 
>   bar
> 
>   <code>
>     $b = "</code>";
> 
>     print "$b\n<code>";
> 
>     print "\n";
>   </code>
> 
>   fubar

That could happen, but it's pretty unlikely.

I have a working version now that works by iterating trough each line, seeing 
if there is a start tag but not an end tag, and if so, add 1 to a variable, and 
only adds the aggregated if this variable is zero.

Your above example outputs this:

Debug:
0: foo
1: <code>
0:   = "</code>";
0:  print "
1: <code>";
1: 
1:  print "
1: ";
0: </code>
0: bar
1: <code>
0:   = "</code>";
0:  print "
1: <code>";
1: 
1:  print "
1: ";
0: </code>

Paragraphs:
---------------
foo
---------------
<code>
     = "</code>";
---------------
    print "
<code>";

    print "
";
</code>
---------------
bar
---------------
<code>
     = "</code>";
---------------
    print "
<code>";

    print "
";
</code>
---------------

Which is completely wrong. But this text:

-------------------------------------------------------------
Hello, my nickname is Sandman, and I like PHP, some examples:

<code>
    print "Hello World";

    print "Foobar";
</code>

Here are nested tags:

<quote>
    <quote>
        He said he liked flowers
    </quote>
    
    Well, he doesn't, ok.

    <quote>I like them</quote>

    Good for you
</quote>

<div class="paragraph">
    Nice paragraph
</div>

<img src="foo.jpg"> <- Nice pic!
-------------------------------------------------------------

Outputs this:

Debug:
0: Hello, my nickname is Sandman, and I like PHP, some examples:
1: <code>
1:     print "Hello World";
1: 
1:     print "Foobar";
0: </code>
0: Here are nested tags:
1: <quote>
2:     <quote>
2:         He said he liked flowers
1:     </quote>
1:     
1:     Well, he doesn't, ok.
1: 
1:     <quote>I like them</quote>
1: 
1:     Good for you
0: </quote>
1: <div class="paragraph">
1:     Nice paragraph
0: </div>
0: <img src="foo.jpg"> <- Nice pic!

Paragraphs:
---------------
Hello, my nickname is Sandman, and I like PHP, some examples:
---------------
<code>
    print "Hello World";

    print "Foobar";
</code>
---------------
Here are nested tags:
---------------
<quote>
    <quote>
        He said he liked flowers
    </quote>
    
    Well, he doesn't, ok.

    <quote>I like them</quote>

    Good for you
</quote>
---------------
<div class="paragraph">
    Nice paragraph
</div>
---------------
<img src="foo.jpg"> <- Nice pic!

-- 
Sandman[.net]


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

Date: Fri, 13 Aug 2004 12:28:38 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: testing without shell access
Message-Id: <Wt2Tc.989$mD.840@attbi_s02>

Tad McClellan wrote:

> You should always, yes *always*, check the return value from open():
>    open (STDERR, '>scriptErr.txt') or die "could not open 'scriptErr.txt' $!";

open(STDERR,'>','scriptErr.txt') or die "Since STDERR is not open, you will 
never see this message when die() is invoked, so you might as well give up."

   or

my $log = 'no_such_directory/log';    # For testing failure mode
open(OLDSTDERR,'>&STDERR') or die "Unable to dup STDERR";
unless(open(STDERR,'>',$log)) {
   print OLDSTDERR "Redirecting STDERR to $log failed: $!\n";
   exit 1;
}
warn "This goes to the file '$log'\n";

	-Joe


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

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


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