[10245] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3838 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 27 18:07:21 1998

Date: Sun, 27 Sep 98 15:00:21 -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           Sun, 27 Sep 1998     Volume: 8 Number: 3838

Today's topics:
        $sth = $dbh->listfields($table) nospam.ajm@antopia.com
    Re: any way to encrypt my script? <Russell_Schulz@locutus.ofB.ORG>
    Re: cat reese > /dev/null (was Re: Perl & Java - differ paulcarlisle@my-dejanews.com
    Re: Converting fixed length ascii to pipe delimited (Mike Stok)
    Re: Converting fixed length ascii to pipe delimited (Allan M. Due)
    Re: Converting fixed length ascii to pipe delimited (Allan M. Due)
        FAQ reading built in to newsreaders (was Re: Is there a <Russell_Schulz@locutus.ofB.ORG>
        free book on sh/sed/awk <lothar@u-aizu.ac.jp>
        how to use variables declared in other file <rjberman@mindspring.com>
    Re: how to use variables declared in other file (Mike Stok)
        insert to sorted list via sort? spav@indiana.edu
    Re: just to show you how screwed up the server is... mike@mjm.co.uk
    Re: just to show you how screwed up the server is... <caustic@causticinteractive.nospam.com>
    Re: perl objects and embedding a hash <gellyfish@btinternet.com>
    Re: perl tutorial <imchat@imchat.com>
        Perl warning  ?! <ralf.meuser@wanadoo.fr>
    Re: POLL: Perl features springing into your face <uri@sysarch.com>
        POSIX test hangs in 5.005_02 install mark.davis@cdc.com
    Re: reducing a variable <kevinbartz@geocities.com>
        regex question <twei@nmsu.edu>
    Re: script: scriptMangle! <Russell_Schulz@locutus.ofB.ORG>
        When did you last use AWK (was Re: free book on sh/sed/ <gellyfish@btinternet.com>
        writing Excel files (was Re: can MSWord and Adobe PDF d <Russell_Schulz@locutus.ofB.ORG>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 27 Sep 1998 21:37:02 GMT
From: nospam.ajm@antopia.com
To: nospam.ajm@antopia.com
Subject: $sth = $dbh->listfields($table)
Message-Id: <6umb5u$gsh$1@nnrp1.dejanews.com>

I may be stupid, but once I've done this, what do I do to see a list of the
fields?  The fetchhash stuff didn't seem to produce anything

Thanks

Anthony

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 27 Sep 1998 14:33:47 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: any way to encrypt my script?
Message-Id: <19980927.143347.8A7.rnr.w164w@locutus.ofB.ORG>

Anonymous <bitnut1@my-dejanews.com> writes:

> Don't worry, noone here will miss your [...]
> rude arrogance.

true, but many would miss his technical comments.

and unjustly calling someone a moron isn't going to make him less arrogant.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Sun, 27 Sep 1998 19:06:22 GMT
From: paulcarlisle@my-dejanews.com
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <6um2be$7e1$1@nnrp1.dejanews.com>

Uh, folks - As interesting and enlightening as this thread has been, maybe
you could move it over to comp.lang.java.programmer.inflatedego.whiners, and
let the rest of us get on without the benefit of your drab, wretched lives.

In article <360E2E11.D3E4048E@min.net>,
  John Porter <jdporter@min.net> wrote:
> George Reese wrote:
> >
> > Do you want me to get it down for you to the exact second?
> > Millisecond?
>
> Why would we expect you to be any more honest about that
> figure than you have been with any other?
>
> --
> John Porter
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 27 Sep 1998 19:25:06 GMT
From: mike@mike.stok.co.uk (Mike Stok)
Subject: Re: Converting fixed length ascii to pipe delimited
Message-Id: <6um3ei$4dn@news-central.tiac.net>

In article <360E88FB.9600899F@home.com>, Alan Melton  <arm@home.com> wrote:
>ASCII Datafile (fixed length)

Fixed length formatted records usually suggest the use of unpack

>Would like help to convert this to:
>
>AE|2102|A|KAMAT|REQ|CRANDALL|INTRODUCTION TO THE
>MECHANICS|0-07-013441-3|
>AE|2102|A|KAMAT|REQ|GERE|MECHANICS OF MATERIALS|0-534-93429-3|

Is that line break meant to be there (between THE and MECHANICS)?  If it
isn't then the use of join is suggested to join the fields we have just
unpacked.

>and also if possible to be able to change file so that it comes out
>
>NAME=AE|CAT=2102|SEC=A|AUTH=KAMAT|  etc

Does this help?  You can use perldoc to read the docs to do with a
particular function e.g.

  perldoc -f join

#!/usr/local/bin/perl

@titles = qw/NAME CAT SEC AUTH WW XX YY ZZ/;
while (<DATA>) {
    chomp;
    @f = unpack 'A5 A7 A5 A12 A4 A12 A32 A13', $_;

    print join ('|', @f, "\n");

    print join ('|', map {$_ . '=' . shift @f} @titles), "|\n";
}

__END__
AE   2102   A    KAMAT       REQ CRANDALL    INTRODUCTION TO THE MECHANICS   0-07-013441-3
AE   2102   A    KAMAT       REQ GERE        MECHANICS OF MATERIALS          0-534-93429-3

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 27 Sep 1998 19:51:07 GMT
From: Allan@Due.net (Allan M. Due)
Subject: Re: Converting fixed length ascii to pipe delimited
Message-Id: <6um4vb$67h$0@206.165.146.62>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <360E88FB.9600899F@home.com>, Alan Melton (arm@home.com) 
posted...
[snip]

|AE   4001   A    SMITH       REQ ANDERSON    FUNDAMENTALS OF
|AERODYNAMICS    0-07-001679-8
|
|Would like help to convert this to:
|
|AE|2102|A|KAMAT|REQ|CRANDALL|INTRODUCTION TO THE
|MECHANICS|0-07-013441-3|
|AE|2102|A|KAMAT|REQ|GERE|MECHANICS OF MATERIALS|0-534-93429-3|
|
|and also if possible to be able to change file so that it comes out
|
|NAME=AE|CAT=2102|SEC=A|AUTH=KAMAT|  etc
|
|Alan Melton
|

Wasn't sure about the spacing between the variables so use 2 or more.  
Here is my shot at it.

@array = ('AE   2102   A    KAMAT       REQ CRANDALL    INTRODUCTION TO 
THE MECHANICS   0-07-013441-3',
'AE   2102   A    KAMAT       REQ GERE        MECHANICS OFMATERIALS          
0-534-93429-3',
'AE   2350   A    MAVRIS      REQ SHEVELL     FUNDAMENTALS OF FLIGHT          
0-13-339060-8',
'AE   2604   A    RUFFIN      REQ ETTER       ENGINEERING PROB SOLV           
0-13-397688-2');

@keys= qw (NAME CAT SEC AUTH SOMETHNG ELSE);

Without the name variables.

foreach (@array) {
    push(@new_array,join('|',split(/\s{2,}/,$_),""));
    }

foreach (@new_array){
    print OUTFILE "$_\n";
}
    

To put the Names with the variables:

    
foreach (@array) {
    @hash{@keys} =split(/\s{2,}/,$_);
    push @listo_hash,{%hash};
    }
    
    
for $href ( @listo_hash ) {
     
     for OUTFILE (@keys) {
         print "$_=$href->{$_}|";
     }
     print OUTFILE "\n"; }    

HTH

-- 
__
Allan M. Due
Allan@Due.net

The beginning of wisdom is the definitions of terms.
- Socrates


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

Date: 27 Sep 1998 20:31:27 GMT
From: Allan@Due.net (Allan M. Due)
Subject: Re: Converting fixed length ascii to pipe delimited
Message-Id: <6um7av$e8b$0@206.165.146.62>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

Hi Folks,

	Sorry about the error below.  Just goes to show what happens when 
you try to do too many things at once.

AmD

In article <6um4vb$67h$0@206.165.146.62>, Allan M. Due (Allan@Due.net) 
posted...

[snip]

|@keys= qw (NAME CAT SEC AUTH SOMETHNG ELSE);
|
|Without the name variables.
|
|foreach (@array) {
|    push(@new_array,join('|',split(/\s{2,}/,$_),""));
|    }
|
|foreach (@new_array){
|    print OUTFILE "$_\n";
|}
|    
|
|To put the Names with the variables:
|
|To put the Names with the variables:
    
|foreach (@array) {
|    @hash{@keys} =split(/\s{2,}/,$_);
|    push @listo_hash,{%hash};
|    }
    
    
The following:

|for $href ( @listo_hash ) {
     
|     for OUTFILE (@keys) {

|         print "$_=$href->{$_}|";
|     }
|     print OUTFILE "\n"; }    

Should be:

for $href ( @listo_hash ) {
     
     for (@keys) {

         print OUTFILE "$_=$href->{$_}|";
     }
     print OUTFILE "\n"; }


Dang I hate when I do that.

__
Allan M. Due
Allan@Due.net

The beginning of wisdom is the definitions of terms.
- Socrates


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

Date: Sun, 27 Sep 1998 13:55:32 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: FAQ reading built in to newsreaders (was Re: Is there any FAQ?)
Message-Id: <19980927.135532.6F0.rnr.w164w_-_@locutus.ofB.ORG>

[ I am using `FAQ' with the silent `L' -> Frequently Asked Questions List ]

"Hansi Hinterseer" <elchmann@hotmail.com> writes:

> X-Newsreader: Microsoft Outlook Express 4.71.1712.3
> I wondered if there is a FAQ about Perl or the NGs. Is there?

of course, perl has many FAQs, many frequently-posted pointers to
these FAQs, and a still questions from the FAQ (and questions asking
if there even IS a FAQ!) are posted every day.

what newsreaders (other than mine) already have a `find a FAQ' button?
if I can do it with UUCP, surely those with an integrated web browser
could do better -- launch a separate window searching on faqs.org
automatically, say.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Mon, 28 Sep 1998 03:58:27 +0900
From: "L. M. Schmitt" <lothar@u-aizu.ac.jp>
Subject: free book on sh/sed/awk
Message-Id: <360E8AD2.859235CC@u-aizu.ac.jp>

FAQ:
Is there a free tutorial/book on SED and AWK on the market?
In particular, for computer novices.
=================================================
There exists a manuscript:
"Combining the Bourne-shell, sed and awk
in the UNIX environment for language analysis"
by Lothar M. Schmitt (The University of Aizu)
and  Kiel T. Christianson (Michigan State University).

It contains a tutorial on the Bourne shell, sed and awk
which is general enough in its scope for most users.

=================================================
Availability of the manuscript:

ERIC Document service:
http://www.aspensys.com/eric/

Posting:
ftp://ftp.u-aizu.ac.jp/u-aizu/doc/Tech-Report/1997/97-2-007.tar.gz

E-mail:
lothar@u-aizu.ac.jp

=================================================
Availabiliy of sh/sed/awk for DOS/Windows:
http://www.cs.utah.edu/csinfo/texinfo/texinfo.html

Availabillity of free UNIX for PC: (how to get started)
http://sunsite.unc.edu/mdw/LDP/gs/gs.html

=================================================
Content:
Tutorial on the Bourne-shell, sed and awk under UNIX.
Constructing tools for language analysis in research
and teaching using sh, sed, and awk:
searches for words, phrases, grammatical patterns and phonemic
patterns in text;
statistical evaluation of texts in regard to such searches;
transformation of phonetic, phonemic or typographic
transcriptions;
comparison of texts in various respects;
lexical-etymological analysis;
concordance;
assistance in translating text;
assistance in learning languages;
assistance in teaching languages;
and text processing and formatting.







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

Date: Sun, 27 Sep 1998 15:42:39 -0500
From: Bob Berman <rjberman@mindspring.com>
Subject: how to use variables declared in other file
Message-Id: <360D66E2.18C8E4C@icehouse.com>

I have a file in which I declare some variables like so:

varx.pm:

@array1=('a','b','c');
$PI=3.14;

1;

In my main Perl script, which happens to start with a package declaration,
I am attempting to make use of the variables in varx.pm. What's the best way
to do this? With a require or a use or what? If in my main script, I do:

package test;

use lib qw(./);
use varx;

print $array[0];

the use is never done. If I follow it in the debugger, the use is skipped right
over. OK, "use" is done at compile time, but I never see the variables defined
and can not access them. I've tried looking for @main::array1, @test::array1,
etc.

How can I make use of a central file of "defines" ,etc.?

I need to use packages, as this is really coming out of a module, but I
can't even get it to work in a little test like above.

It seems to work if I use "require" in this small example, but "require"
is skipped right over if it's in a method of an object.


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

Date: 27 Sep 1998 20:22:44 GMT
From: mike@mike.stok.co.uk (Mike Stok)
Subject: Re: how to use variables declared in other file
Message-Id: <6um6qk$5ri@news-central.tiac.net>

In article <360D66E2.18C8E4C@icehouse.com>,
Bob Berman  <rjberman@mindspring.com> wrote:
>I have a file in which I declare some variables like so:
>
>varx.pm:
>
>@array1=('a','b','c');
>$PI=3.14;
>
>1;
>
>In my main Perl script, which happens to start with a package declaration,
>I am attempting to make use of the variables in varx.pm. What's the best way
>to do this? With a require or a use or what? If in my main script, I do:
>
>package test;
>
>use lib qw(./);
>use varx;
>
>print $array[0];
>
>the use is never done. If I follow it in the debugger, the use is skipped right
>over. OK, "use" is done at compile time, but I never see the variables defined
>and can not access them. I've tried looking for @main::array1, @test::array1,
>etc.
>
>How can I make use of a central file of "defines" ,etc.?

You probably want to take a look at the Exoprter docs using perldoc.  Your
module might say (stealing almost verbatim from the docs...)

  package varx;
  require Exporter;
  @ISA = qw/Exporter/;

  @EXPORT = qw/@array1, $PI/;

  @array1 = ('a' .. 'c');
  $PI = 4;

  1;

You might consider the use of the constant module which would let you say

  use constant PI => 3;

and if you export PI it's difficult to change its value by accident.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Sun, 27 Sep 1998 15:23:40 -0500
From: spav@indiana.edu
Subject: insert to sorted list via sort?
Message-Id: <360E9ECC.327CCD29@indiana.edu>

i am trying to maintain a sorted list of data (frequently updated, needs
to be
sorted). i thought that it could be more efficient to use perl's
internal sort function to make insertions, rather that to write my own
recursive binary insertion subroutine. i have my doubts now, however.
so is it terribly inefficient to do:

    @sorted_list = sort { #comparison code } ($new_element,
@sorted_list);

versus a pure perl binary insert?

thanks muchly,


steven e. pav
spav@indiana.edu



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

Date: Sun, 27 Sep 1998 19:26:29 GMT
From: mike@mjm.co.uk
Subject: Re: just to show you how screwed up the server is...
Message-Id: <360f90ca.15865944@nntp.netcom.net.uk>

I dont think that this is your server...

Before printing any text, you need to tell PERL where to send it..

try;
#!/usr/bin/perl

print "content-type: text/html\n\n"; 
print ("hello world!\n");

Mike


>i tried out a sample script before using the headlines code:
>
>#!/usr/bin/perl
>   print ("hello world!\n");
>
>and i received an 'internal server error'.
>
>then i tried execing the script from the location bar in my browser, then i
>even tried using a SSI <!--#exec cgi="/cgi-bin/headlines"-->
>
>and nothing happens!  :)
>
>i know that perl scripts work because i've got a customized version of
>wwwboard and mailform.
>
>very bizarre.
>
>keith.
>
>
>

Mike
MjM Computer Publishing

http://www.mjm.co.uk/software


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

Date: Sun, 27 Sep 1998 15:53:08 -0400
From: "caustic" <caustic@causticinteractive.nospam.com>
Subject: Re: just to show you how screwed up the server is...
Message-Id: <356c7eae.0@newsprime.tidalwave.net>


mike@mjm.co.uk wrote in message <360f90ca.15865944@nntp.netcom.net.uk>...
>I dont think that this is your server...
>
>Before printing any text, you need to tell PERL where to send it..
>
>try;
>#!/usr/bin/perl
>
>print "content-type: text/html\n\n";
>print ("hello world!\n");


yep...i had tried that, but it didn't work...

vewwy, vewwy stwange.

keith.





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

Date: 27 Sep 1998 20:29:32 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: perl objects and embedding a hash
Message-Id: <6um77c$c5n$1@gellyfish.btinternet.com>

On 27 Sep 1998 17:31:37 GMT JElli23052 <jelli23052@aol.com> wrote:

> I have been working with perl objects for a few weeks.  I would like to 
> add a hash as a member variable(not global).  for example:

> sub new {

>       my $this ={};                               # initialize object "hash"
>      $this->{NewMemberHash}={};        #initialize member variable hash

>       bless($this);
>       return $this;

> } # end sub new

> I would like to know how to access this hash using two public methods, GetHash
> and SetHash.

do you mean something like this:


package HashTest;

sub new 
{
    my $this ={}; 
    $this->{NewMemberHash}={};  
    bless($this);
    return $this;
} 

sub SetHash
{
   my ($this,$key,$value) = @_;

   $this->{NewMemberHash}->{$key} = $value;
}

sub GetHash
{
   my ($this,$key) = @_;
  
   return $this->{NewMemberHash}->{$key};
}

1;
__END__

Which you would use like:


#!/usr/bin/perl

use HashTest;

$ht = new HashTest;

$ht->SetHash("TEST","HeeHee");

print $ht->GetHash("TEST");
__END__

Of course I wouldnt describe that as a complete implementation of a
class module, it doesnt deal with inheritance for one thing.  

I would recommend reading the perltoot,perlobj and perlmod manpages
to get a handle on some of the subtleties here if you havent already.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Sun, 27 Sep 1998 14:41:31 -0500
From: "Mark P." <imchat@imchat.com>
To: chaitra@my-dejanews.com
Subject: Re: perl tutorial
Message-Id: <360E94EB.454F25B8@imchat.com>

You can get a good basic tutorial from Selena Sol at
http://www.web-programming.com/tutorial/cgi/tutorial_perl.shtml

chaitra@my-dejanews.com wrote:

> Hi,
>
> can anyone help me in finding some good perl tutorial on the web.
>
> bye
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum





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

Date: Sun, 27 Sep 1998 22:30:36 +0200
From: "Ralf Meuser" <ralf.meuser@wanadoo.fr>
Subject: Perl warning  ?!
Message-Id: <6um792$or5$1@platane.wanadoo.fr>

When I try   perl -v
I get the follwing message:

perl:  warning: setting local failed.
perl:  warning: Please check that your local settings:
             LC_ALL = (unset),
             LANG = "fr"
    are supported and installed on your system.
perl:  warning:  Falling back to the standard local ("C").

This is perl, version 5.004_04 built for i386-linux

I don't know what is wrong or missing.
Can somebody help me

Ralf Meuser
ralf.meuser@tk-transports.fr






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

Date: 27 Sep 1998 15:26:26 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: POLL: Perl features springing into your face
Message-Id: <x7ogs1uzkt.fsf@sysarch.com>

>>>>> "TAH" == Thomas A Horsley <Tom.Horsley@worldnet.att.net> writes:

  >> c) difference in scope of my and local, of if and when
  TAH> I think I'd restate this one a bit as:

  TAH>     use of "my" outside of a subroutine (inside a routine, it
  TAH> makes just about infinitely more sense to use my than local,
  TAH> outside of a routine, I don't know what good either of them are
  TAH> :-).

lexical vars in a file are very useful. if you use strict you must have
your globals declared via that or use vars. and the great trick to have
static and private vars for a sub is:

{ my $foo ;	# static and private to this block of subs
  sub bar { ....}
  sub baz { ....}
}

  TAH> While we're talking about pet peeves, I'd also add:

  TAH>     barewords - if you want a quoted string, for gosh sakes put
  TAH> $#@!  quotes around it!  --

i @%#%^&$*$ agree!

bareword != qq{string}

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Sun, 27 Sep 1998 19:49:04 GMT
From: mark.davis@cdc.com
Subject: POSIX test hangs in 5.005_02 install
Message-Id: <6um4rg$a3a$1@nnrp1.dejanews.com>

During the 'make test' phase of my install, testing hangs while attempting to
complete step 9 of lib/posix tests. (Test steps 8 - 10 are concerned with
establishing interrupt handlers for INT and HUP signals, then responding to
them).

I'm attempting to build Perl 5.005_02 (with threads enabled, i.e. Configure -
Dusethreads -des) on Solaris 2.5.1. The same test area is (nfs mounted and)
available on a Solaris 2.6 box and the test runs fine there. When it hangs, I
have to kill the process from another window (presumably because an interrupt
handler was enabled in the test script). It doesn't matter which environment I
build Perl in (2.5.1 machine or 2.6), the test fails (hangs) on the 2.5.1
environment only.

So far I've narrowed down the [symptom | problem] to this. If I modify the
test script to comment out references to Config.pm, the test completes fine.
For example, in the following bit of t/lib/posix.t:

#!./perl

BEGIN {
    chdir 't' if -d 't';
    @INC = '../lib';
#    require Config; import Config;
#    if ($^O ne 'VMS' and $Config{'extensions'} !~ /\bPOSIX\b/) {
#        print "1..0\n";
#        exit 0;
#    }
}

Any ideas on what's up with my Solaris 2.5.1 runtime environment or why this
portion of the posix test would hang? Or for that matter why the Config module
is an "issue" here?

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 27 Sep 1998 20:16:19 GMT
From: "Kevin Bartz" <kevinbartz@geocities.com>
Subject: Re: reducing a variable
Message-Id: <6um6ej$aft@bgtnsc02.worldnet.att.net>

This is a multi-part message in MIME format.

------=_NextPart_000_0170_01BDEA31.EC931080
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hmmm... I would use unpack.

$newvar=3Dunpack("a8",$oldvar);

The one line solution!

--- Kevin Bartz
  Rob wrote in message <360E62E6.4030@acc7.ac.cc.md.us>...
  Hi, I'm very new to perl as I'm sure you see by the following code
  segment. I've been trying to shorten the variable $lname to 8 =
characters
  and move that result to $sname and then print it to a file. I've tried
  the following code several different ways but it either doesn't reduce
  $lname at all or reduces it to nothing. Also, when I write to the file
  it will write the first part but not the variable.  Any help would be
  greatly appreciated because I told the boss that I would have it
  finished by Monday %^)
 =20
  $_ =3D $lname;
  $cnt =3D length($_);
  while ($cnt > 8)
  {
     tr/a-z//d;
     $cnt =3D length($cnt);
  }
  $sname =3D $_;
  print OUT "set INETSNAME=3D$sname\n";
 =20
  Thanks in advance
  Rob

------=_NextPart_000_0170_01BDEA31.EC931080
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 5.00.0518.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000080 face=3D"Baskerville Old Face" =
size=3D4>Hmmm... I would use=20
unpack.</FONT></DIV>

<DIV><FONT color=3D#000080 face=3D"Baskerville Old Face" =
size=3D4></FONT>&nbsp;</DIV>

<DIV><FONT color=3D#000080 face=3D"Baskerville Old Face"=20
size=3D4>$newvar=3Dunpack(&quot;a8&quot;,$oldvar);</FONT></DIV>

<DIV><FONT color=3D#000080 face=3D"Baskerville Old Face" =
size=3D4></FONT>&nbsp;</DIV>

<DIV><FONT color=3D#000080 face=3D"Baskerville Old Face" size=3D4>The =
one line=20
solution!</FONT></DIV>

<DIV><FONT color=3D#000080 face=3D"Baskerville Old Face" =
size=3D4></FONT>&nbsp;</DIV>

<DIV><FONT color=3D#000080 face=3D"Baskerville Old Face" size=3D4>--- =
Kevin=20
Bartz</FONT></DIV>

<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000080 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
  <DIV>Rob <ROB@ACC7.AC.CC.MD.US>wrote in message &lt;<A=20
  =
href=3D"mailto:360E62E6.4030@acc7.ac.cc.md.us">360E62E6.4030@acc7.ac.cc.m=
d.us</A>&gt;...</DIV>
  Hi, I'm very new to perl as I'm sure you see by the following =
code<BR>segment.=20
  I've been trying to shorten the variable $lname to 8 characters<BR>and =
move=20
  that result to $sname and then print it to a file. I've tried<BR>the =
following=20
  code several different ways but it either doesn't reduce<BR>$lname at =
all or=20
  reduces it to nothing. Also, when I write to the file<BR>it will write =
the=20
  first part but not the variable.&nbsp; Any help would be<BR>greatly=20
  appreciated because I told the boss that I would have it<BR>finished =
by Monday=20
  %^)<BR><BR>$_ =3D $lname;<BR>$cnt =3D length($_);<BR>while ($cnt &gt;=20
  8)<BR>{<BR>&nbsp;&nbsp; tr/a-z//d;<BR>&nbsp;&nbsp; $cnt =3D=20
  length($cnt);<BR>}<BR>$sname =3D $_;<BR>print OUT &quot;set=20
  INETSNAME=3D$sname\n&quot;;<BR><BR>Thanks in =
advance<BR>Rob</BLOCKQUOTE>
</BODY></HTML>

------=_NextPart_000_0170_01BDEA31.EC931080--



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

Date: Sun, 27 Sep 1998 15:00:22 -0700
From: Tao Wei <twei@nmsu.edu>
Subject: regex question
Message-Id: <360EB576.2CDC3739@nmsu.edu>

Hi there,
It is stated in Jeffrey Friedl book "Mastering Regular Expression" that
there are 25 tests and 7 backtracking of involved in matching
"([^"\\]+|\\.)*" with "2\"x3\" likeness". Can someone explain this to
me. Thanks in advance.

Tao Wei



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

Date: Sun, 27 Sep 1998 13:45:32 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: script: scriptMangle!
Message-Id: <19980927.134531.4H0.rnr.w164w@locutus.ofB.ORG>

Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> writes:

> To make Perl 'unreadable' is almost blasphemy.

I thought it was the point of the Obfuscated Perl Contest.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: 27 Sep 1998 21:50:29 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: When did you last use AWK (was Re: free book on sh/sed/awk)
Message-Id: <6umbv5$cio$1@gellyfish.btinternet.com>

In comp.lang.perl.misc L. M. Schmitt <lothar@u-aizu.ac.jp> wrote:
> FAQ:
> Is there a free tutorial/book on SED and AWK on the market?
> In particular, for computer novices.

<snip>

I dont know about anyone else but I havent actually used AWK for nearly
four years - when I took over my present job I inherited a bunch of
programs written in AWK that were strangely Perl-ish in their idiom - all
explicit file open and while loop.  Anyhow I fed them to a2p, gave up and
totally rewrote in Perl and as far as I know they are still being used now.

But apart from that I cant think of a possible situation where I might use
AWK nowadays.  But of course others may differ in their opinion.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Sun, 27 Sep 1998 14:40:25 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: writing Excel files (was Re: can MSWord and Adobe PDF docs be read for indexing?)
Message-Id: <19980927.144025.7w7.rnr.w164w_-_@locutus.ofB.ORG>

"Pat Trainor" <ptrainor@bbn.com> writes:

> What is required (even for $$$) that enables perl to write data in
> msword, excel, pdf formats?

for Excel, see the c.a.s FAQ:

The FAQ list for comp.apps.spreadsheets can be found on the Internet:
  <ftp://rtfm.mit.edu/pub/usenet/comp.apps.spreadsheets/faq>
  <http://www.faqs.org/faqs/spreadsheets/faq/>

14.7 Excel formats
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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