[6409] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 34 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 1 16:07:36 1997

Date: Sat, 1 Mar 97 13:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 1 Mar 1997     Volume: 8 Number: 34

Today's topics:
     Re: !!!help me please!!! (Laurel Shimer)
     Re: Assigning an element to a multidimensional hash <tchrist@mox.perl.com>
     class inheritance problem with autoload <john.lewis@syspac.com>
     Editting files inline (Kevin Posen)
     Re: Editting files inline <dbenhur@egames.com>
     GET maximum exposure for your WEB site FREE!!! (Rich)
     Re: Getting vars after http://ww/page.cgi? <HERE> (Tad McClellan)
     Re: Getting vars after http://ww/page.cgi? <HERE> <dbenhur@egames.com>
     Re: Help with Perl and Window95 <riskmgmt.cmurdock@capital.ge.com>
     Help! Problem using CGI.pm <kkchiang@pacific.net.sg>
     How big is big? (Mark (Mookie))
     Re: Intrpretor Perl 5 for Win95... <riskmgmt.cmurdock@capital.ge.com>
     novice begin perl asaharty@hotmail.com
     Re: Numeric versions of sort/reverse? <dbenhur@egames.com>
     Re: Perl 4 -> Perl5, SEGV from Carp::Longmess.  Please  <mcampbel@tvmaster.turner.com>
     Perl5 installation on OpenServer <kheller@gtelink.com>
     Please Respond <mogreen@ix.netcom.com>
     Re: Please Respond (Nathan V. Patwardhan)
     Reading from a Socket on the fly ("ubiquitous (Jonathan Eisenman)")
     Redirect For MSIE and Windows NT <jsmith@guesswho.net>
     Re: Simple tr/// (Tad McClellan)
     Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
     Re: uc without explicit argument inside map. Bug? (Dominic Dunlop)
     Re: Validating data using // <jstrick@mindspring.com>
     Re: Validating data using // <jstrick@mindspring.com>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Sat, 01 Mar 1997 10:42:14 -0700
From: autopen@quake.net (Laurel Shimer)
Subject: Re: !!!help me please!!!
Message-Id: <autopen-0103971042140001@l1.d22.quake.net>

In article <3315C339.3AF3@ntplx.net>, anon7@ntplx.net wrote:

Al

I'm not sure that the following script will really solve your problem.

My impression is that you can't capture e-mail id's normally from a web page.

Others- Isn't that right?

Laurel


 > 
>         I'm trying to learn enough perl to modify a script called WWWBoard (by
> Matt Wright, who I've tried to contact -- unsuccessfully) in order to
> hide any/all obtainable user info in the posted messages, to try to help
> catch anonymous posters of obscene msgs.
> 
>         I've found the $ENV 'REMOTE_HOST' but it only seems to take me back to
> the users' host.  I can't seem to get the users' id/username.  Is that
> possible?
>         
 
>         What's the best way to identify a user of a site that's running perl
> scripts?

You may want to setup accounts to use the BBOARD. Selena Sol's site has
Web Board code that forces people to maintain an account. Would that work
in your situation?

http://www.sidestreets.com/info/sssa


> 
 ------------- THIS SCRIPT will display all the $ENV even if it doesn't
solve this problem. You should give it a quick try -------------


>         Is there a list of $ENV somewhere?

Well here is a nice little script that Tom Phoenix wrote which I use. It
will show you everything it can see for you - as a nice formatted web page


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

#!/usr/bin/perl -w

# Prints out environment variables

# Copyright (C) Tom Phoenix <rootbeer@teleport.com>    April 1996
# You may use this script (and modifications of it) for nice
# non-commercial purposes without further permission. Enjoy!
#
# Note: It's especially useful to set this script as the action to a form, 
# then see what data it gets. Be sure to use method GET.

# Want to see some source code?
if ($ENV{PATH_INFO} =~ /source/i) {
  print "Content-type: text/plain\n\n";
  seek(DATA,0,0);       # Prep to read the whole thing
  while (<DATA>) {
    print
  }
  exit
}

sub safe_html {
  # see http://hopf.math.nwu.edu/html2.0/html-spec_3.html#SEC11
  local($_) = $_[0];
  s/&/&amp;/;
  s/</&lt;/;
  s/>/&gt;/;
  return $_;
}

print <<"EOstart";
Content-type: text/html

<html><head><title>Environment variables</title></head>
<body><h1>Environment variables</h1>

Here's a list of all of the current environment variables:<p>

<ul>
EOstart

foreach (sort keys %ENV) {
  print "<li>",&safe_html($_),": &quot;",&safe_html($ENV{$_}),"&quot;\n";
}

print <<"EOfinish";

</ul>

That's all!<p>

Want to see <a href= "env-vars/source" >the source for this script</a>?<p>

Tom Phoenix &lt;rootbeer\@teleport.com&gt;<p>
</body></html>
EOfinish

__END__



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

-- 
        The Reader's Corner: Mystery, Romance, Fantasy 
     Short stories, excerpts, themes and resources 
        http://www.autopen.com/index.shtml 
     Subscribe to our free StoryBytes publication
Current Mermaids Issue at http://www.autopen.com/mermaids.shtml


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

Date: 1 Mar 1997 14:47:33 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Assigning an element to a multidimensional hash
Message-Id: <5f9fi5$rf5$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Chris Plachta <stats9@mail.idt.net> writes:
:If I have a hash:
:
:
:$hash{KEY1}{INFO1} = value;
:$hash{KEY1}{INFO2} = value;
:$hash{KEY1}{INFO3} = value;
:$hash{KEY2}{INFO1} = value;
:$hash{KEY2}{INFO2} = value;
:$hash{KEY2}{INFO3} = value;
:
:and I want to assign some other hash a particular value:
:
:$new_hash{KEY1} = $hash{KEY1}
:
:without creating a reference, how do I do it?  When I do the above,
:%new_hash gets referenced to %hash, so now both data structures are
:pointing to the same data.  I would like to avoid explicitly assigning
:each value like this:
:
:  $new_hash{KEY1}{INFO1}=$hash{KEY1}{INFO1};
:  $new_hash{KEY1}{INFO2}=$hash{KEY1}{INFO2};
:  $new_hash{KEY1}{INFO3}=$hash{KEY1}{INFO3};
:
:Any ideas?  Thanks in advance.


Have you tried something like 

    $new_hash{KEY1} = { %{$hash{KEY1}} };

Not saying it efficient, but if you have to copy you have to 
copy.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    "Yes, you can think of almost everything as a function, but this may upset
    your wife." --Larry Wall


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

Date: Sat, 01 Mar 1997 10:29:16 -0700
From: "John A. Lewis" <john.lewis@syspac.com>
Subject: class inheritance problem with autoload
Message-Id: <3318676C.6ACF@syspac.com>

 I am writing a new set of methods to extend an existing object class.
Everything works great, except for methods which are autoloaded within
the parent class.

Since the $AUTOLOAD variable now contains my package name instead of the

parent's package name, its AUTOLOAD routine attempts to get the methods
from a directory with my package name, which doesn't exist.

Any suggestions on how best to deal with this?



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

Date: Sat, 01 Mar 1997 13:16:55 GMT
From: posenj@lancet.co.za (Kevin Posen)
Subject: Editting files inline
Message-Id: <5f9a90$2jf@news1.saix.net>

Hi everyone.

Can anyone tell me why this doesn't edit the file given, or create a backup file?

print "Enter file to edit: ";
chomp ($_ = <>);
print "Enter backupfile extension: ";
chomp ($^I = <>);
open (FILE, "$_") || die "Could not open file:\n$!\n";
print "Enter word to search for: ";
chomp ($search = <>);
print "Enter word to replace with: ";
chomp ($replace = <>);
$word = "";
while ($word !~ /\b(yes|no)\b/i) {
 print "Replace whole words only: ";
 $word = <>;
}
if ($word =~ /\byes\b/i) {
 while (<FILE>) {
  s/\b$search\b/$replace/gi
 }
} else {
 while (<FILE>) {
  s/$search/$replace/gi
 }
}
close (FILE);

Thanks.

Kevin Posen



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

Date: Sat, 01 Mar 1997 12:46:57 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: posenj@lancet.co.za
Subject: Re: Editting files inline
Message-Id: <331895C1.1AEC@egames.com>

[courtesy reply emailed]
Kevin Posen wrote:
> Can anyone tell me why this doesn't edit the file given, or create a backup file?
[snip]
> open (FILE, "$_") || die "Could not open file:\n$!\n";
[snip]
> if ($word =~ /\byes\b/i) {
>  while (<FILE>) {
>   s/\b$search\b/$replace/gi
>  }
> } else {
>  while (<FILE>) {
>   s/$search/$replace/gi
>  }
> }
> close (FILE);

Because all you do is read the file.  Nowhere do you
print the results of your changes to a new file or
rename the old file to a backup.

Try somthing like this:
open(IN, $filename) or die(...);
open(OUT, ">$filename.tmp") or die(...);
while (<IN>) {
    s/$search/$replace/gio;	# o-ptimize option will speed it up
    print OUT;
}
close(IN); close(OUT);
rename($filename,"$filename.bak") or die(...);
rename("$filename.tmp",$filename) or die(...);

If you don't really need all that interactive stuff
at the beginning, you might want to investigate the -p 
and -i commandline options which automatically wrap your 
code with just this kind of loop. eg:
  perl -p -i.bak -e "s/\bsearch\b/replace/ig;" <filespecs>...
will do your "whole words" option on all the files you specify at 
the end of that command.

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Don't run away. We are your friends."  O-



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

Date: Sat, 01 Mar 1997 22:07:48 GMT
From: rich@cris.com (Rich)
Subject: GET maximum exposure for your WEB site FREE!!!
Message-Id: <3318a8a8.25767788@news.concentric.net>

While most banner exchange programs are based on a 50% ratio,
LINK-TRADER gives you 70% credit. For every 10 impressions you display
on your site, you will get 7 credits to display your banner on other
sites. For more info:
http://www.linktrader.com/
or to sign up:
http://www.linktrader.com/signup.htm


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

Date: Sat, 1 Mar 1997 07:57:01 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Getting vars after http://ww/page.cgi? <HERE>
Message-Id: <djc9f5.vp.ln@localhost>

David Weibel (weibeld@clem.mscd.edu) wrote:
: How do you get the variables using perl/cgi-lib.pl
: after the standard URL like...
: http://www.server.com/~acct/my.cgi?<The variables here?>

: I'm sure this has to be pretty easy but I can't find any documentation
: on it.  I know how to get them with c++.  So I would think I can with
: perl.  Please let me know...


foreach (@ARGV)
   {print "$_\n"}


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


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

Date: Sat, 01 Mar 1997 12:28:40 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: David Weibel <weibeld@clem.mscd.edu>
Subject: Re: Getting vars after http://ww/page.cgi? <HERE>
Message-Id: <33189178.685@egames.com>

[courtesy reply emailed]
David Weibel wrote:
> How do you get the variables using perl/cgi-lib.pl
> after the standard URL like...
> http://www.server.com/~acct/my.cgi?<The variables here?>
> 
> I'm sure this has to be pretty easy but I can't find any documentation
> on it.  I know how to get them with c++.  So I would think I can with
> perl.  Please let me know...

This is documented in the comments at the top of the cgi-lib.pl
file.

&ReadParse();
$name = $in{'name'};	# sets $name to value of CGI var: name=value

Pretty trivial yes?

However, you really should go to CPAN and grab a copy of CGI.pm
and use it instead of the antiquated Perl4 'cgi-lib.pl'.
CGI.pm is more robust, more powerful, and properly maintained
and documented.

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks"  O-
    -- Sonia Orin Lyris




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

Date: Thu, 27 Feb 1997 16:00:00 -0500
From: Chris Murdock <riskmgmt.cmurdock@capital.ge.com>
Subject: Re: Help with Perl and Window95
Message-Id: <3315F5D0.771D@capital.ge.com>

I use Microsoft Front Page with it's personal web server.  It works
fine!


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

Date: Sat, 01 Mar 1997 23:44:30 -0800
From: kkchiang <kkchiang@pacific.net.sg>
Subject: Help! Problem using CGI.pm
Message-Id: <33192FDE.4B58@pacific.net.sg>

Hi! Currently, I'm running perl in NT and am having problem in getting
CGI.pm to work in my scripts. I have changed $OS="WINDOWS" in the CGI.pm
which resides in the d:\perl5\lib and d:\perl5\lib\cgi.

The hello2.pl is as follows:

#!/usr/bin/perl
#
# CGI script using CGI.pm module.
#
use lib '..';
use CGI;

$page = new CGI;

# Print page header.
print $page->header;

print $page->start_html(
    -title=>'Hello from perl', 
    -BGCOLOR=>'white'); 


# HTML body

# Heading
print "<h1>Hello</h1>\n";

print "Hello, from perl and the CGI module.";
print "<p>\n";  # Paragraph

# End HTML page.
print $page->end_html;

# hello2.cgi

<----------------program ends--------------------------------->

The error messages:

1) Identifier "Connfig::Config used only once: possible typo at         
D:\perl5\lib/CGI.pm line 53.

2) ( offline mode: enter name=value pairs on standard input)

After it displayed this message, it hanged.

Hope that someone could give me a solution.

Thanks in advance.

kk.
kkchiang@pacific.net.sg


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

Date: 1 Mar 1997 17:09:40 GMT
From: mark@zang.com (Mark (Mookie))
Subject: How big is big?
Message-Id: <5f9nsk$p9k@nuhou.aloha.net>
Keywords: MAXINT Biguns

Hi,

This:

sub num {
    local($num) = @_;
    if ($num < 1000) { return("RET: $num"); }
    return("OK: $num");
}

$num = &num(8); print "$num\n";
$num = &num(78); print "$num\n";
$num = &num(678); print "$num\n";
$num = &num(5678); print "$num\n";
$num = &num(45678); print "$num\n";
$num = &num(1000567); print "$num\n";
$num = &num(56051004); print "$num\n";
$num = &num(556051004); print "$num\n";
$num = &num(9556051004); print "$num\n";
$num = &num(39556051004); print "$num\n";
$num = &num(739556051004); print "$num\n";

Gives me:

RET: 8
RET: 78
RET: 678
OK: 5678
OK: 45678
OK: 1000567
OK: 56051004
OK: 556051004
RET: 9556051004
RET: 39556051004
RET: 739556051004

Obviously some limit is being breached but what is it? MAXINT in unix? Some
internal limit in perl5.003? I grepped a bit through the perl5 manuals but
nothing came to light. Since I regularly deal with largish numbers it would
be good to find a solution to this one. Is it possible to change intsize to
some order of magnitudes bigger?

Cheers,
Mark
mark@zang.com

Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=solaris, osver=2.5, archname=sun4-solaris
    uname='sunos missi 5.5 generic_103093-03 sun4m sparc sunw,sparcstation-5 '
    hint=recommended, useposix=true, d_sigaction=define
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.7.2.2
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'





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

Date: Thu, 27 Feb 1997 16:04:18 -0500
From: Chris Murdock <riskmgmt.cmurdock@capital.ge.com>
Subject: Re: Intrpretor Perl 5 for Win95...
Message-Id: <3315F6D2.3330@capital.ge.com>

Get the Perl Interpreter from Win32.  It works fine with Front
Page/Personal Web Server.


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

Date: Sat, 01 Mar 1997 14:33:11 -0600
From: asaharty@hotmail.com
Subject: novice begin perl
Message-Id: <857247644.29858@dejanews.com>

hi
i am a computer user and i am not involved in programming.
i am asking about web sites that can help me in starting
to program in PERL(for beginners) as well as books.
thanks

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


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

Date: Sat, 01 Mar 1997 12:17:25 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: bassler@i1.net
Subject: Re: Numeric versions of sort/reverse?
Message-Id: <33188ED5.1AD3@egames.com>

[courtesy reply emailed]
bassler@i1.net wrote:
> Howdy.  Do there happen to be similar commands to sort and reverse that
> work with numeric values instead of ASCII ala these two commands?
> True, I guess I COULD have bunch of fun and sort the array numerically
> with stacks, etc, but would appreciate it if anyone could enlighten me
> with an easier way/command.  Thanks in advance.

reverse doesn't do any comparisons at all, it just reverses the
order of an array.

The default sort sorts by ascending ASCII order, but you
can specify an alternative sort function:
   @sorted = sort { $a <=> $b } @unsorted;
will sort using numerical comparison.

See man perlfunc or Camel p.217-219

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Don't run away. We are your friends."  O-




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

Date: 01 Mar 1997 14:24:45 -0500
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: Perl 4 -> Perl5, SEGV from Carp::Longmess.  Please read
Message-Id: <r5zpwnh0ua.fsf@tvmaster.turner.com>

sb@netcom.com (Microserf) writes:

> can someone please tell me why this may be happening or what to look
> for?  the only lib. i am using newgetopt.pl in the begining to get
> args.

Perl 5.000 had a core dump problem with the getopt family of libs.
Make sure you using at _least_ 5.002; preferably 5.003.  And try a 
"use Getopt::Long;", as newgetopt is simply a wrapper around that.


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

Date: Sat, 01 Mar 1997 09:46:03 -0500
From: Karl Heller <kheller@gtelink.com>
Subject: Perl5 installation on OpenServer
Message-Id: <3318412B.CCB@gtelink.com>

Has anyone installed perl5 on SCO OpenServer?  I'm getting the following
error when I run MAKE:

Termination Code 139
 ./miniperl -Ilib pod/pod2html.PL


Any help would be greatly appreciated!


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

Date: Sat, 01 Mar 1997 12:48:07 -0500
From: Scott Green <mogreen@ix.netcom.com>
Subject: Please Respond
Message-Id: <33186BD7.1FD5@ix.netcom.com>

Would somebody please look at this and tell me what is wrong?

#! /usr/local/bin/perl

if ($ENV{'HTTP_REFERER'} ne 'www.mydomain.com')

 {
	print <<"HTML";
     <HTML>
     <HEAD>
     <TITLE>Illegal</TITLE>
     </HEAD>
     <BODY>
     <H1> User Unauthorized <H1>
	<br>
	
	Sorry, but this server has no permissions to access this script.
     </BODY>
     </HTML>

HTML

     exit;
}

Thank You, you can email me at mogreen@ix.netcom.com if you have any
solutions.

Scott Green


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

Date: 1 Mar 1997 18:22:11 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Please Respond
Message-Id: <5f9s4j$pti@fridge-nf0.shore.net>

Scott Green (mogreen@ix.netcom.com) wrote:
: Would somebody please look at this and tell me what is wrong?

Yes, I'll offer some suggestions about problem areas:

(1) Not to be offensive, but your subject header STINKS!  Read the
    weekly posting on this newsgroup called "getting the most out of
    comp.lang.perl.misc" for future posting guidelines.  It also
    describes ineffective subject headers.  Non-descript subject headers
    irritate people who are trying to help you and are meaningless to
    people searching for answers to the same question in Usenet archives.

(2) Does HTTP_REFERER have a value?  You might want to output the value 
    of this variable for debugging purposes.  I suspect that either
    HTTP_REFERER has no value, or you aren't comparing the values
    properly.

    Ex: print("<B>Referrer: </B>$ENV{'HTTP_REFERER'}\n");

    OR, print all your environment values:

    foreach $key (keys %ENV) {
       print("$key has a value of $ENV{$key}<BR>\n");
    }

(3) In the future, post all CGI-related questions to 
    comp.infosystems.www.authoring.cgi.

--
Nathan V. Patwardhan
nvp@shore.net
"What is your favorite color?
Blue ... I mean yellow ... aieeeee!
	--From the Holy Grail"


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

Date: Sat, 1 Mar 1997 11:16:41 -0500
From: ubiquitous@beachside.com ("ubiquitous (Jonathan Eisenman)")
Subject: Reading from a Socket on the fly
Message-Id: <199703011725.MAA25819@surf.beachside.com>

Well, after much use of the good information you guys have given me, I
return yet again with another problem.  I have a script that creates a
socket using Shishir Gundavaram's sockets.pl from ftp.ora.com.  I was just
wondering if there is a way to read output from the socket as it comes in
rather than with clunky

while (<POP3>){
	etc..
	etc..
}

I haven't been able to think of one myself, and of course the problem
arises that I am using someone else's library so I may not even be able to
do what you suggest.  I would rather write the socket connection routine
into my script, but I don't know any of those weird looking (to me at
least) S n a4 x8 type numbers.  But my more immediate problem comes from
the clunkiness (REALLY) and possibly the nonfunctionalness of the while
loops (it takes the program forever to do anything and nothing gets done). 
ANY help would be appreciated but I prefer email as my USENET server is
somewhat (extremely) unreliable.  Thanks again!

									Jonathan H. Eisenman

Jon says:
"Start your day off right with a cup of Java and some cookies."
http://home.beachside.com/ubiquitous/ 



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

Date: 1 Mar 1997 16:56:32 GMT
From: "Joe Smith" <jsmith@guesswho.net>
Subject: Redirect For MSIE and Windows NT
Message-Id: <01bc2661$52d97f00$03e087cf@support_pc.sierra.net>

We are porting our UNIX Perl scripts to NT 4.0 box.

The code we wrote to redirect a browser works fine on both Netscape and
MSIE but using on the NT box Netscape works but MSIE just prints the code.

The code we are using is :

print status: 302 Redirected;
print Content-type: text/HTML;
print Location: $FORM{'url'};

Anyone know why MSIE does not redirect?

Thanks
Mike jmike@sierra.net


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

Date: Sat, 1 Mar 1997 07:59:25 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Simple tr///
Message-Id: <tnc9f5.vp.ln@localhost>

Ken Schrock (kens@cannet.com) wrote:
: I am new to Linux but played with Perl under NT...
: If I do MAN XXX > FILE I get stuff that looks like...

: N\bNA\bAM\bME\bE
:        ps - report process status


Man pages have all that underlining, bolding and stuff.

man nroff | col -b >man_nroff.txt

should convert it to plain old ASCII


: So I thought fine, I will use Perl tr/// 
: To get this garbage out, 
: But I appear to be holding my mouth wrong. <g>
: Will someone please help me?


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


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

Date: 1 Mar 1997 19:45:44 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <5fa118$cal@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 21 Feb 1997 19:31:07 GMT and ending at
01 Mar 1997 07:58:51 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^(>|:|\S+>)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" e-mail address and name.

Totals
======

Total number of posters:  511
Total number of articles: 1114
Total number of threads:  458
Total volume generated:   1827.9 kb
    - headers:    693.7 kb
    - bodies:     1070.1 kb (784.2 kb original)
    - signatures: 61.6 kb

Averages
========

Number of posts per poster: 2.2
Number of posts per thread: 2.4
Message size: 1680.2 bytes
    - header:     637.6 bytes
    - body:       983.7 bytes (720.8 bytes original)
    - signatures: 56.7 bytes

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   70    89.9 ( 39.6/ 50.2/ 39.1)  Nathan V. Patwardhan <nvp@shore.net>
   48    95.2 ( 28.0/ 67.1/ 33.8)  Tad McClellan <tadmc@flash.net>
   41    69.6 ( 32.3/ 37.3/ 27.0)  Tom Phoenix <rootbeer@teleport.com>
   38    70.2 ( 29.0/ 34.7/ 24.6)  Tom Christiansen <tchrist@mox.perl.com>
   26    45.4 ( 14.6/ 22.7/ 16.1)  mike@stok.co.uk
   20    35.4 ( 13.2/ 22.3/ 14.3)  dbenhur@egames.com
   19    27.2 ( 11.5/ 15.3/  4.9)  Jim Anderson <jander@ml.com>
   17    31.6 ( 11.1/ 20.4/ 10.0)  billc@tibinc.com
   14    22.5 (  8.0/ 11.5/  7.0)  Dave@Thomases.com
   14    20.2 ( 10.7/  8.4/  8.3)  Bill Kuhn <wkuhn@uconect.net>

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  95.2 ( 28.0/ 67.1/ 33.8)     48  Tad McClellan <tadmc@flash.net>
  89.9 ( 39.6/ 50.2/ 39.1)     70  Nathan V. Patwardhan <nvp@shore.net>
  70.2 ( 29.0/ 34.7/ 24.6)     38  Tom Christiansen <tchrist@mox.perl.com>
  69.6 ( 32.3/ 37.3/ 27.0)     41  Tom Phoenix <rootbeer@teleport.com>
  45.4 ( 14.6/ 22.7/ 16.1)     26  mike@stok.co.uk
  35.4 ( 13.2/ 22.3/ 14.3)     20  dbenhur@egames.com
  31.6 ( 11.1/ 20.4/ 10.0)     17  billc@tibinc.com
  27.2 ( 11.5/ 15.3/  4.9)     19  Jim Anderson <jander@ml.com>
  26.3 (  8.8/ 16.5/ 10.8)     14  Russ Allbery <rra@cs.stanford.edu>
  24.4 (  7.4/ 16.9/ 10.9)     14  Honza Pazdziora <adelton@fi.muni.cz>

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   34  How to spam - legitimately
   22  futur de perl et java-script
   12  Generating a randomly sorted list of integers
   11  how long before I can put down the books?
   11  File Locking
   11  Regular Expression question
    9  Perl on Windows 95
    8  Multi-line processing
    7  Using a variable for mode in chmod and mkdir
    7  simple new question!

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

  73.9 ( 29.6/ 41.4/ 31.5)     34  How to spam - legitimately
  40.2 ( 16.0/ 23.4/ 16.6)     22  futur de perl et java-script
  29.0 (  5.4/ 21.5/ 15.2)      7  Class library to make C++ more Perlish?
  25.4 (  8.5/ 16.4/ 11.9)     12  Generating a randomly sorted list of integers
  22.6 (  3.8/ 18.1/ 13.4)      6  Regular Expression - Always seems simple/I always fight 'em
  21.8 (  7.7/ 13.8/  9.2)     11  Regular Expression question
  18.1 (  7.4/  9.9/  6.6)     11  File Locking
  17.6 (  6.7/ 10.7/  4.2)      9  Perl on Windows 95
  16.8 (  1.6/ 14.7/ 13.8)      3  ISO Perl Soundex function
  16.0 (  7.1/  7.9/  5.0)     11  how long before I can put down the books?

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      34  comp.mail.misc
      34  comp.mail.sendmail
      28  comp.lang.perl.modules
      18  comp.lang.perl
      15  comp.lang.perl.tk
       7  comp.lang.c++
       6  comp.lang.awk
       4  comp.sys.mac.misc
       3  comp.databases
       3  comp.lang.javascript

Top 10 Crossposters
===================

Articles  Address
--------  -------

      15  Markus Fleck <fleck@informatik.uni-bonn.de>
      13  Tom Christiansen <tchrist@mox.perl.com>
       9  Chris Nandor <pudge@pobox.com>
       6  Hans Schrader <hans.schrader@geol.uib.no>
       5  Robert Michael Slade <rslade@vcn.bc.ca>
       5  Nathan V. Patwardhan <nvp@shore.net>
       4  Tom Phoenix <rootbeer@teleport.com>
       4  Natanya <natanya@io.com>
       4  Lee <DeathToSpam@dev.null.com>
       4  hanklem@ibm.net


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

Date: Tue, 25 Feb 1997 09:29:32 +0100
From: domo@tcp.ip.lu (Dominic Dunlop)
Subject: Re: uc without explicit argument inside map. Bug?
Message-Id: <19970225092932285817@dialup01.ip.lu>

Dave Peters <dave@nuance.com> wrote:

> Running perl5.003. Platform doesn't seem to be relevant: the behaviour
> is the same on the six platforms I tried.
> 
> ---
> % perl -le 'print join "_",map { uc } split "-","this-is-a-string"'
> Not enough arguments for upper case at -e line 1, near "uc }"
> Execution of -e aborted due to compilation errors.
> ---
> but:
> ---
> % perl -le 'print join "_",map { uc $_ } split "-","this-is-a-string"'
> THIS_IS_A_STRING
> ---
> I'd have hoped that uc would behave like most of the other functions,
> and employ $_ as its default argument! Is this fixed in the current
> version?

It's fixed in the current development version of Perl, 5.003_28, so
expect it to be fixed in 5.004 also.
--- 
Dominic Dunlop


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

Date: Sat, 01 Mar 1997 09:41:46 -0500
From: John Strickler <jstrick@mindspring.com>
To: Mark Thompson <mwt@cyberg8t.com>
Subject: Re: Validating data using //
Message-Id: <3318402A.C7946A@mindspring.com>

Mark Thompson wrote:
[snip snip ] Basically, I'm trying to limit
> the user's input to letters and numbers with a minimum of 1 and a
> maximum of 10 characters.
> 
> I tried doing it like this:
> 
> if($oldusername ne /[A-Za-z0-9]{1,10}/)
                  ^^^
Here's the problem:
   "ne" compares two strings to see if they're exactly the same. You
need the "=~" operator,
    which determines whether the variables on the left matches the
pattern on the right. Although
    it's not obvious to someone just starting in Perl, / / represents
the pattern-matching 
    operator. You have, on the other hand, properly constructed your
regular expression.

A non-Perl aside:
     How come you don't want nonalphanumerics in your users' passwords?
Using such makes them
     _much_ harder to guess, and thus more secure. 
> {
>      $error += 1;
>      $errormsg[$error] = "$oldusername is not a valid username";
> }

--
John Strickler --  Perl/UNIX/C Trainer, Consultant
Jeffersonian Consortium            Voice:     919-682-3401     
HTTP://WWW.JCINC.COM               Facsimile: 919-682-3369


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

Date: Sat, 01 Mar 1997 10:16:42 -0500
From: John Strickler <jstrick@mindspring.com>
To: John Strickler <jstrick@mindspring.com>
Subject: Re: Validating data using //
Message-Id: <3318485A.61677A26@mindspring.com>

My reply to Mark Thompson was slightly boneheaded, viz:
John Strickler wrote:
> Mark Thompson wrote:
> [snip snip ] Basically, I'm trying to limit
> > the user's input to letters and numbers with a minimum of 1 and a
> > maximum of 10 characters.
> >
> > I tried doing it like this:
> >
> > if($oldusername ne /[A-Za-z0-9]{1,10}/)
>                   ^^^
> Here's the problem:
>    "ne" compares two strings to see if they're exactly the same. You
                                                 ^^^^^^^^^^^^^^^^^^ oops
-- I mean "different"
> need the "=~" operator,
           ^^^^  oops again (but at least I'm consistent) I meant "!~"
>     which determines whether the variables on the left matches the
> pattern on the right. [and so forth]
Sorry, folks, too early on a Saturday morning....

--
John Strickler --  Perl/UNIX/C Trainer, Consultant
Jeffersonian Consortium            Voice:     919-682-3401     
HTTP://WWW.JCINC.COM               Facsimile: 919-682-3369


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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

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