[7168] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 793 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 30 03:21:31 1997

Date: Wed, 30 Jul 97 00:00:32 -0700
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, 30 Jul 1997     Volume: 8 Number: 793

Today's topics:
     Re: "Fast forward" within while loop? <mattrope@mdhost.cse.tek.com>
     Re: "Fast forward" within while loop? <dq@leland.Stanford.EDU>
     Re: ++ Not Working?? (Bryan Shea)
     [Q] Checkbox forms in Perl <dyrewolf@worldnet.att.net>
     Re: ANYONE KNOW OF A GOOD BOOK FOR LEARNING PERL <rootbeer@teleport.com>
     Re: Assoc. array initialization query (Jeff Stampes)
     Re: comment <burleigh@hackberry.chem.niu.edu>
     help unescape (Haris Kusumo)
     HELP With Oraperl installation on HPUX runing ORacle 7. <azadpoum@mantis.sps.mot.com>
     Re: Help: problem with ftp.pl and chat2.pl <gprasad@ti.com>
     Modules on Win32? <pociask@maricopa.edu>
     Re: Need source example: fetch HTML from a URL (Paul J. Schinder)
     Re: open a url <burleigh@hackberry.chem.niu.edu>
     optionally using packages <usenet-tag@qz.little-neck.ny.us>
     Re: perltroubles <clark@s3i.com>
     Re: Poetry questions (Tad McClellan)
     Q: PORTing Sybperl to mSQLperl dileep@wlink.com.np
     Re: Release newer than 5.004_01? <merlyn@stonehenge.com>
     Re: Removing Carriage Returns??? (Steve Cotton)
     SOCKS support in Perl (Mark A. Lehmann)
     Re: Unix time, local time, year 2000 question. <mail08216@pop.net>
     Re: using substr inside regexp for substitutions (Tad McClellan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 29 Jul 1997 16:12:03 -0700
From: Matt Roper <mattrope@mdhost.cse.tek.com>
To: Qiang Dai <dq@leland.Stanford.EDU>
Subject: Re: "Fast forward" within while loop?
Message-Id: <Pine.SUN.3.95q.970729161021.18896S-100000@tekgp4.cse.tek.com>


Maybe you need to use something like:

for ($i=1;$i<=$lines_to_ignore;$i++) {
	$junk=<FILEHANDLE>;
}

Hope this helps.


On Tue, 29 Jul 1997, Qiang Dai wrote:

> Hi,
> 
> I often need to extract certain number of lines from a file.
> Sometimes I know how many lines I want, sometimes I
> know what the starting and ending lines are. It would be
> convenient if I could just ask the while loop to advance
> so many lines, once I have identified the starting line,
> without the lines being processed by other statements
> in the while loop. I am now doing this by turning on and
> off a boolean variable. It gets very confusing if I need
> to do a few of these within the same while loop.
> 
> Is there a good construct in Perl that does this more
> efficiently? 
> 
> Thanks,
> John
> 
> 
> 

==============
Matt Roper
mattrope@mdhost.cse.tek.com



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

Date: Tue, 29 Jul 1997 22:31:31 -0700
From: Qiang Dai <dq@leland.Stanford.EDU>
To: Dean Inada <dmi@questrel.com>
Subject: Re: "Fast forward" within while loop?
Message-Id: <Pine.GSO.3.96.970729222135.22389C-100000@epic4.Stanford.EDU>

On Tue, 29 Jul 1997, Dean Inada wrote:
> while (<FIN>){
> 	if( /WantedBegin/../WantedEnd/ ){
> 		#$on = 1;
> 		stuff_if_on;
> 	}else{
> 		#$on = 0;
> 		stuff_unless_on;
> 	}
> }

Did not try this, but your next suggestion 
of using $_ = <FIN> is exactly what I needed. Why did I not think
of that? This does what I wanted:

while (<FIN>) {
	some_stuff;
	if (/$begin/) {
		# Stuff inside the next loop is not bothered
		# by some_stuff and other_stuff, and vice versa.
		while (! /$end/) {
			do_my_stuff;
			$_ = <FIN>;
			next;
		};
	};
	other_stuff;
}

Thanks!
John



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

Date: Tue, 29 Jul 1997 14:28:35 -0700
From: mrshea@sprintmail.com.nospam (Bryan Shea)
Subject: Re: ++ Not Working??
Message-Id: <MPG.e480061b853caf698968b@snews2.zippo.com>

In article <m390yp3b7u.fsf@lorien.ajs.com>, ajs@lorien.ajs.com says...
> Vik Rubenfeld <VikR@aol.com> writes:
> 
> > My PERL script keeps track of the number of times it has run, by incrementing
> > a value in a COUNTER file. It's always run fine, but today I was running it on
> > a new server, and no matter how many times I run it, the value in the COUNTER
> > file remains 1. The code is shown below. What am I missing here? Is there
> > another way to increment the value of $counter ?
I had this problem when moving onto another server too.  Make sure you 
have write permission set correctly for the owner of the file.  
-- 
Bryan Shea


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

Date: Tue, 29 Jul 1997 10:35:24 -0700
From: Adam Grayson <dyrewolf@worldnet.att.net>
Subject: [Q] Checkbox forms in Perl
Message-Id: <33DE29DC.5BD7@worldnet.att.net>

I'm new to this, so please pardon any taboos. 

I have an HTML form with a list of items, each with a checkbox next to
it. The purpose of the script is to see which were checked off, and to
run a function as a result of it. I was told by one person to give each
checkbox the name, but different values, and by another to give each
different names, and put "yes" as the value on each. I know that's more
an HTML issue, but please excuse it. 

Thanks in advance to anyone who can help.

Adam Grayson

P.S. If possible, please reply via e-mail as well as posting a reply to
the newsgroup. Thanks


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

Date: Tue, 29 Jul 1997 10:44:46 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: DanitoFool <danitofool@aol.com>
Subject: Re: ANYONE KNOW OF A GOOD BOOK FOR LEARNING PERL
Message-Id: <Pine.GSO.3.96.970729104241.3584E-100000@kelly.teleport.com>

On 27 Jul 1997, DanitoFool wrote:

> Subject: ANYONE KNOW OF A GOOD BOOK FOR LEARNING PERL

You don't need to shout. We're right here! :-)

> I am looking for a good book or online manual to learn perl from, please
> help and e-mail me back if you know of any? 

Here's a reference to a good book, and it's even _called_ Learning Perl.
:-) Hope this helps!

    http://www.ora.com/catalog/lperl2/noframes.html

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 29 Jul 1997 22:51:15 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Assoc. array initialization query
Message-Id: <5rls53$gug$1@neocad.com>

Simon Fairey (sfairey@adc.metrica.co.uk) wrote:
: > associative
: > arrays before I use them using:
: >
: > %array = {};
: >
: > I was doing this as I believed it was a good idea, and also to ensure
: > that the array was empty at that point and hadnt got anything else in
: > it  that may have been left over from a previous invocation of the
: > array.
: >

:  I believe arrays and hashes are initialised as empty to start with,
: however clearing them is always worth doing if your code is ever going
: to end up looping and you don't want the array/hash to grow.  I think {}
: should normally be used to denote a BLOCK rather than an array/hash and
: in the past I have always used () when clearing arrays/hashes ( whether
: that is 100% correct I am not sure, but 5.004 doesn't complain. ).
: I am not sure what the implications are of using {}, I doubt there are

The difference is that

%foo = ();

creates an empty hash, while

$foo = ();

Creates a reference to an empty anonymous hash.  For example:

  DB<1> $ref = {}

  DB<2> $$ref{Sam} = 'Bush'

  DB<3> x $ref
0  HASH(0xb0a38)
   'Sam' => 'Bush'
  DB<4> %hash = ()

  DB<5> $hash{Sam} = 'Bush'

  DB<6> x %hash
0  'Sam'
1  'Bush'


--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Tue, 29 Jul 1997 15:03:58 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: comment
Message-Id: <33DE4CAE.5A6E@hackberry.chem.niu.edu>

John Liao wrote:
> 
> Is there a equivalent  /*   */ for comments in perl?
> Thanks
> --
>         _/            _/                  _/  _/
>              _/_/    _/_/_/    _/_/_/    _/        _/_/_/    _/_/
>       _/  _/    _/  _/    _/  _/    _/  _/  _/  _/    _/  _/    _/
>      _/  _/    _/  _/    _/  _/    _/  _/  _/  _/    _/  _/    _/

#  the '#' character comments out the rest of the line

$comments = <<COMMENTS;
 but i don't think that's what you had in mind.
 probably
   you  
     want 
      comments over multiple
  lines. here is one way. 
COMMENTS

-- 
==========================================================
 - darin
burleigh@hackberry.chem.niu.edu
\\//\\//.\\//\\//.\\//\\//. http://hackberry.chem.niu.edu/HOME/dcb/
 '2 kinds of green, look out!' - dieter rot


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

Date: 28 Jul 1997 14:43:50 +1000
From: hkusumo@socs.uts.EDU.AU (Haris Kusumo)
Subject: help unescape
Message-Id: <5rh826$dfa@franklin.socs.uts.EDU.AU>
Keywords: help unescape

Hi,

I am trying to write cgi-script using perl.
It seems the text that I get from Netscape, has been converted with javascript escape sequence.

here is my html
<html>
<body>
<form method="POST" action="/cgi-bin/testform">
Enter text: <textarea rows="10" cols="60" name="fred"></textarea><br>
<input type="submit" value="submit">
</form>
</body>
</html>

when I type in Hello, there
I get fred=Hello%2C there

here is my perl script
#!/usr/bin/perl

$!=1;

print "Content-type: text/html\n\n";
print "\n";

read (STDIN, $form, ENV{'CONTENT_LENGTH'});

@pair = split (/&/, $form);
foreach $pair (@pair) {
	($name, $value) = split (/=/, $pair);

	$value =~ tr/+/ /;

	print "$name=$value\n";
}

could you tell me what do I have to do so the text that I get from perl is in mornal format instead of getting some hexvalue for a certain characters.

I appreciate if you could e-mail me the reply to
	hkusumo@socs.uts.edu.au		or
	haris_kusumo@modusmedia.com

Thanks in advance.
- Haris -


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

Date: Tue, 29 Jul 1997 14:00:22 -0500
From: Mark Azadpour <azadpoum@mantis.sps.mot.com>
Subject: HELP With Oraperl installation on HPUX runing ORacle 7.2.3
Message-Id: <33DE3DC6.269F@mantis.sps.mot.com>

I have build perl-4.036 and oraperl Revision: 4.0.1.8 Date:1993/02/05
successfully.  When I go to run the oraperl test program that comes with
the makefile, I get the folllowing error: 

Testing oraperl, please wait ...
Error while trying to retrieve text for error ORA-12545
*** Error exit code 2

and when I go to *.log at the testdir directory.  I see the following:

 ***********************************************************************
Fatal OSN connect error 12545, connecting to:

(DESCRIPTION=(ADDRESS=(PROTOCOL=beq)(PROGRAM=oracle)(ARGV0=oracleDDSPC)(ARGS='(
DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')(DETACH=NO))(CONNECT_DATA=(CID
=(PROGRAM=)(HOST=crazy)(USER=azadpoum))))

  VERSION INFORMATION:
        TNS for HPUX: Version 2.2.3.0.0 - Production
        Oracle Bequeath NT Protocol Adapter for HPUX: Version 2.2.3.0.0
- Produc
tion
  Time: 29-JUL-97 13:53:30
  Tracing not turned on.
  Tns error struct:
    nr err code: 12206
    TNS-12206: Message 12206 not found; No message file for
product=NETWORK, fac
ility=TNS
    ns main err code: 12545
    TNS-12545: Message 12545 not found; No message file for
product=NETWORK, fac
ility=TNS
    ns secondary err code: 12560
    nt main err code: 515
    TNS-00515: Message 515 not found; No message file for
product=NETWORK, facil
ity=TNS
    nt secondary err code: 2


The oracle manual says that ORA_12545 is a name lookup failure. It says
the most likely problem is the address field specification.  could some
one point me to the right place?

where are these specified within the oraperl package.

Thanks,
Mark A.

please reply and post.


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

Date: Tue, 29 Jul 1997 17:47:22 -0500
From: Gowri Prasad Gandluri <gprasad@ti.com>
To: ba.wrr@rlg.org
Subject: Re: Help: problem with ftp.pl and chat2.pl
Message-Id: <33DE72FA.A772EC80@ti.com>

Wes Ramirez wrote:

> On a Solaris 2.5 sys I am trying to run a automatic ftp script.  It
> uses
> "require "ftp.pl" which in turn makes a call to chat2.pl.   One of the
>
> manuals mentioned a problem with chat2.pl and System5.  The script
> dies
> immediately after its request to resolve dns name of the target ftp
> site. It never even attempts to make a tcp ftp call.  Yes, I don't
> have
> a clue why.  Help anyone, please?  Thanks
>
> Wes Ramirez

Have you tried lchat.pl (modified version of chat2.pl)? Also makesure
your ftp.pl has a - require "sys/socket.ph" instead of "sys/socket.h".
You can use h2ph utility to do this conversion.

Prasad




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

Date: Tue, 29 Jul 1997 12:12:35 -0600
From: Jason Pociask <pociask@maricopa.edu>
Subject: Modules on Win32?
Message-Id: <33DE3293.7D08@maricopa.edu>

Will modules from CPAN such as libwww-perl, and it's required
libnet*, MD5*, MIME-Base64*, and IO-1-1* modules install and
run properly under the Activeware Win32 port of perl (on WIn95)?

The base64 module, for example, is using .XS to interface to
a C routine for performance.  What kind of C support do I need
on the Win95 box so that the "make"s will run OK?  I have MS VC++
5.0, is that enough?

Thanks for pointers to any helpful docs also,

-JP


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

Date: Tue, 29 Jul 1997 19:49:53 -0400
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: Need source example: fetch HTML from a URL
Message-Id: <schinder-2907971949530001@schinder.clark.net>

In article <33DD2D8E.6B86@maricopa.edu>, Jason Pociask
<pociask@maricopa.edu> wrote:

}  Surely someone has a PERL program that is non-proprietary
}  enough to email it to me: just need a simple program or sub
}  that takes a URL, opens up a web connection, and fetches
}  the HTML page back for parsing.  I know enough perl, but
}  pulling together all the right _use_ modules is proving
}  a little tough.  If I just had a working example, I'd be
}  off and running on an important project.
}  
}  Many thanks in advance, no explanations or support needed,
}  just a little bit of code, maybe something that was done
}  for fun or as part of a publicly funded project.

What do you want to do, get the page in a variable or drop it on the disk?

#!perl

use LWP::Simple;
$page = get "http://yadda.yadda/";


or


#!perl

use LWP::Simple;
getstore "http://yadda.yadda/","where_to_put_it";

As they say in the classic Ronco ads, "It's just that easy!".  (Assuming
you have libwww-perl-5 installed, which you can get from any CPAN
archive.)

}  
}  -Jason P.       pociask@maricopa.edu

-- 
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@leprss.gsfc.nasa.gov


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

Date: Tue, 29 Jul 1997 15:00:48 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: open a url
Message-Id: <33DE4BF0.4272@hackberry.chem.niu.edu>

Jose Ignacio wrote:
> 
> First pardon about my english. i don't speak english very well
> I have the next problem, I don't know how to open a url for reading. I
> try open (FILE, "http://www.xxxxx.com/gg.htm) but this don't work.
> This open (FILE, "gg.htm") work ok but the other no.
> How can i open an URL like http://www.xxxxxx.com/gg.htm ??
> Please e-mail me to jigonzalez@readysoft.es
> Thanks to all
> Regards
> Jose Ignacio


you need the LWP module. Look it up under CPAN.
-- 
==========================================================
 - darin
burleigh@hackberry.chem.niu.edu
\\//\\//.\\//\\//.\\//\\//. http://hackberry.chem.niu.edu/HOME/dcb/
 '2 kinds of green, look out!' - dieter rot


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

Date: 29 Jul 1997 19:24:38 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: optionally using packages
Message-Id: <eli$9707291501@qz.little-neck.ny.us>

I want a script to use a package for enhanced functionality as an
option. I do not want the script to require the package. It is too
much nuissance trying explain to complete neophytes who might want
to use the script how to find CPAN and install a module.

Here's what I have tried:

Line#

 21	if ( $cleanup =~ /^y/i ) {
 22	  # Needed to handle RFC address annoyances.
 23	  use Mail::Address;
 24	}

	...

406	if ($complete =~ /^(originator|sender|reply-to|from): (.+)\s$/is) {
407	  $hname=$1;
408	  $hname=~tr/A-Z/a-z/;
409	  $rfcpart=$2
410	  if ( $cleanup =~ /^y/i ) {
411	    $parsed=(Mail::Address->parse($rfcpart))[0];
412	    $from{$hname}=$parsed->address();
413	  } else {
414	    $from{$hname}=$rfcpart;
415	  }
416	}

With a perl that does not know where Mail/Address.pm is on my system,
`perl -wc` gives me the error:

    Can't locate Mail/Address.pm in @INC at bounce line 23.
    BEGIN failed--compilation aborted at bounce line 23.

With a perl that *does* know where Mail/Address.pm is on my system,
it works fine.

So how does one do this? 'use' from eval? Can I create stubs for
the module in my script? (I want a *single* file for neophyte set
ups.) I know I could do this by creating some sort of Makefile to
build the correct version of the script, but I would rather not.

Elijah
------
skimmed perlmod and did not see anything about optional modules


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

Date: 29 Jul 1997 14:30:46 -0400
From: Clark Dorman <clark@s3i.com>
Subject: Re: perltroubles
Message-Id: <dk9i9ww15.fsf@s3i.com>


Greetings,
	First, I let you know that the Subject line was not terribly
informative, so I almost skipped it. 

erwinmol@dds.nl (Erwin Moller) writes:

> Dear reader, (janl?) I'm just starting with Perl. Can somebody tell me
> what's wrong with this program? It's a simple program that increases and
> decrease letters in a sentence. My email is erwinmol@dds.nl

Who is janl?
 
> print ("\nGive me a sentence, please:");
 
> $inp=<>;
> chomp $inp;
> @zin=();
> 
> while (length($inp) > 0)
>  {
>   $letter=chop $inp;
>   push @zin,$letter

While this does in fact work, it is better to have a ";" at the end, I
think.

[snip]
>   print ++$zin[$i];
[snip]
>   print --$zin[$i];
  
You would think that this would work in both cases, wouldn't you.
But, in the perlop page it says:

######################################################################

Auto-increment and Auto-decrement
---------------------------------

"++" and "-" work as in C.  That is, if placed before a variable, they
increment or decrement the variable before returning the value, and if
placed after, increment or decrement the variable after returning the
value.

The auto-increment operator has a little extra builtin magic to it.  If
you increment a variable that is numeric, or that has ever been used in
a numeric context, you get a normal increment.  If, however, the
variable has been used in only string contexts since it was set, and
has a value that is not null and matches the pattern
`/^[a-zA-Z]*[0-9]*$/', the increment is done as a string, preserving
each character within its range, with carry:

     print ++($foo = '99');        # prints '100'
     print ++($foo = 'a0');        # prints 'a1'
     print ++($foo = 'Az');        # prints 'Ba'
     print ++($foo = 'zz');        # prints 'aaa'

The auto-decrement operator is not magical.
######################################################################

This means that "--" doesn't do what you think it want.  This also
means that I don't think that you are going to get what you think you
are going to get when you use ++.  What are you expecting to get when
you use 'z' and increment it?  What did you want when you have 'a' and
decrement it?

While this magic is spiffy, I personally would not trust it and use it
unless I knew that what it did is just what I want it to do.  

-- 
Clark Dorman				"Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick


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

Date: Mon, 28 Jul 1997 15:24:18 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Poetry questions
Message-Id: <i5vir5.k1a.ln@localhost>

Toutatis (toutatis@remove.this.toutatis.net) wrote:
: How to write cleaner scripts:

: $var2 = $var;
: $var2 =~ tr/qwerty/asdfg/;

: Can I do that in a single statement?
: like: $var2 = $var =~ tr/qwerty/asdfg/;


($var2 = $var) =~ tr/qwerty/asdfg/; # you were so darn close  ;-)


: But then in a way that it does what I want?


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 29 Jul 1997 13:01:31 -0600
From: dileep@wlink.com.np
Subject: Q: PORTing Sybperl to mSQLperl
Message-Id: <870198736.7085@dejanews.com>

In the Dec 96 issue of SysAdmin, I found an article on a web-based
helpdesk.  The author used Sybase and sybperl.  I would like to port
 it to mSQL and msqlperl.  The author told me that sybperl is ANSI
compliant.

I am new to Perl leave alone msqlperl or sybperl.  So, I request you
gurus to assist me.  I am enclosing one of the scripts.

TIA

Dileep Agrawal

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

#!/nfs/public/bin/sybperl
#
# Program:  daysopen.pl      Description:  Display all open tickets,
starting
#                                          with oldest first, and give
links
#                                          to get the status of each
ticket.
#
# This is part of the Helpdesk Management System written by Mark Mellman.
#
# Date last revision: 07/07/96   Version: 2.00

require "helpdesk.inc";

#########################################################################
#  Execute query and calculate number of days open for assigned tickets
#########################################################################

&helpdesk_login;
$totday=0;
$tabrow=0;
&startup;
$dbproc = &dblogin("$opt_u", $pw, $opt_s);
&dbuse($dbproc, $opt_d);
&dbuse ($opt_d);
$str="
select ticketId, days=datediff(day, submitDate, getdate()), assigned,
submitLastName, priority
       from OTicket where status = \"A\" or status = \"U\"";
&dbcmd($dbproc, $str);
&dbresults($dbproc);
&dbsqlexec ($dbproc);
if(&dbresults($dbproc)==&SUCCEED) {
  while(@data=&dbnextrow($dbproc)) {
    &do_point(@data);
  }
}
print "</table>\n";
printf "<br><br><font size=+2>Totals:  Open/Unassigned Tickets: %d
Average Days Open: %d</font>", $tabrow, $totday/$tabrow;
print "</html>\n";
exit;

#################################
#  Do the isql query
#################################

sub do_isql
{
   &dbcmd($dbproc, $str);
   if (&dbsqlexec ($dbproc) !=&SUCCEED)
   {
      print "Error executing command\n";
   }
   &dbresults($dbproc);
}

######################################
#  Setup html code
######################################

sub do_point {
  @tmp=@_;
  printf "<tr><td><a
href=\"hdstatus.pl?ticknum=%d\">%5.5d</a></td><td>%3.3d</td><td>%s</td><td
>%s</td><td>%d</td></tr>\n", $tmp[0], $tmp[0], $tmp[1], $tmp[2], $tmp[3],
$tmp[4];
  $tabrow=$tabrow+1;
  $totday=$totday+$tmp[1];
}

################################################################
#  Display setup html and headings
################################################################

sub startup {
  print "Content-type: text/html\n\n";
  print "<body  bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#CC0000\"
alink=\"#FF3300\" vlink=\"#330099\">\n";
  print "<center><font size=+2>Number of Days
Report</font></center><br>\n";
  print "<hr><br>\n";
  print "<table border>\n";
  print "<tr><td>Ticket Number</td><td>Days Open</td><td>Ticket
Owner</td><td>Submitter</td><td>Priority</td></tr>\n";
}

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 29 Jul 1997 12:41:15 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: "Robert Pang" <rpang@us.oracle.com>
Subject: Re: Release newer than 5.004_01?
Message-Id: <8cu3hd3auc.fsf@gadget.cscaper.com>


note: comp.lang.perl hasn't existed for two years.  Please don't
post to a dead group. :-)

>>>>> "Robert" == Robert Pang <rpang@us.oracle.com> writes:

Robert> I am planning to upgrade my Perl installation from 5.003.
Robert> Just wanna check and see if there will a newer version of Perl
Robert> than 5.004_01 (for UNIX platforms) in the forseeable future?
Robert> Are we expecting one within the next 2 months?  If not, I will
Robert> just upgrade it now.  I just wanna save some effort from
Robert> another upgrade in the next 2 months should there be any.

5.004_02 just had a candidate release (internal to the P5P) within the
past 48 hours.  If all goes well, I presume it'll be out the door with
two weeks or so.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 398 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 29 Jul 1997 10:15:13 GMT
From: cottons@bre.co.uk (Steve Cotton)
Subject: Re: Removing Carriage Returns???
Message-Id: <5rkfrh$1co$1@sys10.cambridge.uk.psi.net>


In article <5rd5gf$cgo$1@bashir.ici.net>, burt@ici.net (Burt Lewis) writes:

|> I have a script that's reading the input from an HTML form and I can't seem 
|> to remove ALL of the carriage returns. It may not be just the very last 
|> character, there could be some anywhere.  Since I'm writing this to a single 
|> line text file I need to strip them all away. 

A global search & replace on \n is all you need:

$line_of_text =~ s/\n//g;

Hope that helps.

Steve.


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

Date: 29 Jul 1997 13:29:07 -0500
From: mlehmann@prismnet.com (Mark A. Lehmann)
Subject: SOCKS support in Perl
Message-Id: <5ben8haf0s.fsf@smokey.prismnet.com>

I see the Net::SOCKS module is still in "under contruction" stage.  Lately I
have socksified my perl compiler, but I find some underlying problems.  I
would very mush like to see socks support added to IO::Socket and
IO::Socket::INET to get around these problems and to make SOCKS code
available to the greater Perl public, who don't compile their perl
compilers.

I sent notes to Simon Cooper (owner of Net::SOCKS) and to Graham Barr (owner
of IO::Socket and IO::Socket::INET) but got no response.

I'd like to work on this and want to have a discussion with people interested
in SOCKS and perl.  I would like to know what direction Net::SOCKS is heading.


-- 
Mark Lehmann.


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

Date: Tue, 29 Jul 1997 15:12:39 -0400
From: Mark Feit <mail08216@pop.net>
To: michal@gortel.phys.ualberta.ca
Subject: Re: Unix time, local time, year 2000 question.
Message-Id: <33DE40A7.446B9B3D@pop.net>

Michal Jaegermann wrote:
>
> : Year 2038.  And what Perl does on such a time, I can only
> : speculate. :-)
> 
> 64-bit processors will be likely then tad more popular that they are
> now. :-)

True, but it's never too early for the consulting industry to jump on
the Y292M problem.  :-)

						- Mark


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

Date: Mon, 28 Jul 1997 15:19:40 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: using substr inside regexp for substitutions
Message-Id: <ssuir5.k1a.ln@localhost>

Larry Riddle (LRiddle@ness.agnesscott.edu) wrote:
: I am just learning Perl and am having trouble trying to do the following
       ^^^^^^^^^^^^^^^^^^

We could already tell that because you get -w warnings from your
code, and all experienced Perl programmers use the -w switch (hint #1)  ;-)


: (I have checked the FAQ lists and a Perl reference without success).


Excellent!

We appreciate that.


: I would like to take an expression like
: <a href="abcdefghijk.htm">
: and truncate the htm file name to just 8 characters to get
: <a href="abcdefgh.htm">. I want to do something like


OK, but be warned that if you have two such URLs that are not
unique in the first eight chars, you may get unexpected results...


: s/\"(.+)\.htm\b/\"substr(\1,1,8)\.htm/g;
    ^             ^               ^

double quotes are not special in regex or replacement part, so
you don't need to escape them. Dot is not special in the replacement
part either.


: s/\"(.+)\.htm\b/\"substr(\1,1,8)\.htm/g;
                           ^^

-w switch would warn you that it is not done this way anymore (though
it still works). Nowadays you use $1 in the replacement part. Use \1
only in the regex part.


: s/\"(.+)\.htm\b/\"substr(\1,1,8)\.htm/g;
                              ^

String indices start with zero, not one.


: but this substitutes the entire expression substr(\1,1,8) rather than
: evaluating the substr function and substituting the result. The
  ^^^^^^^^^^

'cause you didn't tell it to evaluate it. If you don't tell it to, perl
will only do interpolation.

You use s///e to tell perl to evaluate the replacement part.


: substitution also needs to work on expressions like
                                     ^^^^^^^^^^^

[ it would be less confusing if you called it a string rather than
  an expression
]

: <a href="http://www.xxx.yyy/zzz/abcdefghijk.htm">

: and just truncate the abcdefghijk part to 8 letters. The method above
: doesn't work on this because it picks up everything from the first
: quotemark, not just the abcdefghijk.htm part. Any help would be

So write your expression so that it does NOT pick up everything 
from the first quotemark  ;-)


: appreciated. Please respond by email also if you send a response back to
: the newsgroup. Thank you.


This might do it:

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

$_ = '<a href="abcdefghijk.htm">';
s/"(.+)\.htm\b/'"' . substr($1,0,8) . ".htm"/eg;
print "'$_'\n";


# a different URL, first 8 chars are the same. Is that gonna be a problem?

$_ = '<a href="abcdefghijklmnopqrstuvwxyz.htm">';
s!([^/"]+)\.htm\b!substr($1,0,8) . ".htm"!eg;
print "'$_'\n";


$_ = '<a href="http://www.xxx.yyy/zzz/abcdefghijk.htm">';

s!([^/"]+)                      # any chars except slash and double quote
  \.                            # a literal dot/full stop/period
  htm                           # three literal chars
  \b                            # a word boundary, could look for the
                                #    closing double quote instead
 !substr($1,0,8)                # keep the first 8 chars
  .                             # concatenated with
  ".htm"                        # these four literal chars
 !egx;                          # e => Evaluate the replacement part
                                # g => global (ie. more than one on a line)
                                # x => lets me put these comments here

print "'$_'\n";
-------------------------


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 793
*************************************

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