[23630] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5837 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 20 21:05:39 2003

Date: Thu, 20 Nov 2003 18:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 Nov 2003     Volume: 10 Number: 5837

Today's topics:
    Re: Comments on parsing solution. <REMOVEsdnCAPS@comcast.net>
    Re: Comments on parsing solution. <REMOVEsdnCAPS@comcast.net>
    Re: Comments: locking variables <mb@uq.net.au.invalid>
    Re: Comments: locking variables <usenet@morrow.me.uk>
    Re: Comments: locking variables <REMOVEsdnCAPS@comcast.net>
    Re: DBI Question <kbass@midsouth.rr.com>
    Re: Image::Magick memory leak question <usenet@morrow.me.uk>
        prevent \\\\ from getting substituted to \ in a system  <asdf@asdf.com>
    Re: prevent \\\\ from getting substituted to \ in a sys <alex lyman @ earthlink.net>
    Re: Protecting Source code of a perl script <flavell@ph.gla.ac.uk>
    Re: Protecting Source code of a perl script (James Willmore)
    Re: Protecting Source code of a perl script <REMOVEsdnCAPS@comcast.net>
        Reading a flat file into Excel sheet (dn_perl@hotmail.com)
    Re: Reading a flat file into Excel sheet <asu1@c-o-r-n-e-l-l.edu>
    Re: Reading a flat file into Excel sheet <dan@mathjunkies.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 20 Nov 2003 19:40:29 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Comments on parsing solution.
Message-Id: <Xns9439D26EE4EB1sdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Glenn Jackman <xx087@freenet.carleton.ca> wrote in 
news:slrnbrpr47.cjj.xx087@smeagol.ncf.ca:

> Prabh <Prab_kar@hotmail.com> wrote:
> 
>     #!/usr/local/bin/perl
>     use strict;
>     use warnings;
>     
>     # always check the return value of open()
>     open F, "file" or die "can't open file: $!\n";
>     my %hash;
>     while (<F>) {
>         $hash{(split /:/)[0]} ++;
>     }
>     close F;
>     foreach my $f (sort keys %hash) {
>         print "$hash{$f} lines of info on $f\n";
>     }

Are you golfing, or trying to help?  If the latter, perhaps you would be 
so kind as to provide a bit of explanation, instead of just throwing some 
fairly dense code at the novice?

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP71tNWPeouIeTNHoEQK0uACeLe3zEYqMPXUPiXLfVvIs39LrHOUAn2M/
wGx6tVOBDtx4eLz5SspJnxlg
=7F8a
-----END PGP SIGNATURE-----


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

Date: Thu, 20 Nov 2003 19:42:35 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Comments on parsing solution.
Message-Id: <Xns9439D2CA3F7D7sdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Tore Aursand <tore@aursand.no> wrote in news:pan.2003.11.20.16.28.22.46067
@aursand.no:

>   my @files = ();
>   my %seen  = ();

Why not simply

    my @files;
    my %seen;

?
Less typing, less chance for typos.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP71ts2PeouIeTNHoEQJtFwCgqigQ9GmGiMJrqUF3fHohcYmBKoYAoKVX
L5ZcTnjn9ZonQiNNsZwguDPz
=foWb
-----END PGP SIGNATURE-----


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

Date: Fri, 21 Nov 2003 10:13:45 +1000
From: Matthew Braid <mb@uq.net.au.invalid>
Subject: Re: Comments: locking variables
Message-Id: <bpjlbp$m1r$1@bunyip.cc.uq.edu.au>

Ala Qumsieh wrote:


> package lockKey;
> 
> sub TIEHASH {
>   my ($class, $key) = @_;
> 
>   my $obj = bless {
>      LOCKED => $key,
>      HASH   => {},
>     };
>   return $obj;
> }
> 
> sub FETCH { $_[0]{HASH}{$_[1]} }
> 
> sub STORE {
>   my ($this, $k, $v) = @_;
> 
>   if ($this->{LOCKED} eq $k) {
>     # only store if it's not defined already.
>     return if exists $this->{HASH}{$k};
>   }
> 
>   $this->{HASH}{$k} = $v;
> }
> 
> sub FIRSTKEY {  # copied from perltie
>   my $this = shift;
>   my $a    = keys %{$this->{HASH}};          # reset each() iterator
>   each %{$this->{HASH}};
> }
> 
> sub NEXTKEY  { each %{$_[0]{HASH}} }

Hmmm. This still has a problem (that might actually exist in the 
Tie::Watch form too):

# put the package lockKey stuff here....

package main;
my %hash;
tie %hash, 'lockKey', 'AltUID';

$hash{test}   = 'a';
$hash{AltUID} = 'value1';

print "$_ = $hash{$_}.\n" for keys %hash;

# NEW STUFF HERE
package lockKey;

sub STORE {
   my ($this, $k, $v) = @_;
   $this->{HASH}{$k} = $v;
}

# END NEW STUFF, which could be inserted in a script easily
package main;

$hash{test} = 'b';
$hash{AltUID} = 'value2';

print "$_ = $hash{$_}.\n" for keys %hash;

__END__

Which results in:

AltUID = value1.
test = a.
AltUID = value2.
test = b.


I'm begining to wonder if there's a way of locking a value at all now....

1) The Hash::Util has the problem that anyone can unlock the value using 
Hash::Util as well.

2) The direct tie (and possibly Tie::Watch) method suffers from a 
package override.

I'm starting to think the way to do it may be:

package Whatever;
my $Protected = {};
 ...
sub _initialise {
   my $self = shift;
   ...
   $Protected->{$self} = {AltUID => -1};
   ...
}

sub AltUID {
   my $self = shift;
   return undef if not exists($Protected->{$self});
   return $Protected->{$self}->{AltUID};
}

sub DELETE {
   my $self = shift;
   delete($Protected->{$self});
}

__END__
EOF

That way the AltUID value is stored in a my'd package variable that 
can't be accessed directly from the outside (even by a package override) 
and only has a readonly accessor. Now I just need to figure out how 
child packages are going to work with this...

Blurgh. This is why I still think perl5's objects are very broken. The 
paradigm that 'people messing with your internals should know what 
they're doing anyway' is fatally flawed - they may know exactly what 
they're doing - circumventing code you really don't want altered...



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

Date: Fri, 21 Nov 2003 01:30:24 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Comments: locking variables
Message-Id: <bpjprg$3a9$2@wisteria.csv.warwick.ac.uk>

Matthew Braid <mb@uq.net.au.invalid> wrote:
> Blurgh. This is why I still think perl5's objects are very broken. The 
> paradigm that 'people messing with your internals should know what 
> they're doing anyway' is fatally flawed - they may know exactly what 
> they're doing - circumventing code you really don't want altered...

 ...in which case it's their problem when things go wrong.

Ben

-- 
  The cosmos, at best, is like a rubbish heap scattered at random.
                                                         - Heraclitus
  ben@morrow.me.uk


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

Date: Thu, 20 Nov 2003 20:03:29 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Comments: locking variables
Message-Id: <Xns9439D6550B30Csdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Matthew Braid <mb@uq.net.au.invalid> wrote in news:bpjlbp$m1r$1
@bunyip.cc.uq.edu.au:

> package Whatever;
> my $Protected = {};
> ...
> sub _initialise {
>    my $self = shift;
>    ...
>    $Protected->{$self} = {AltUID => -1};
>    ...
> }

Yes, this is a good way.
You can even limit $Protected even more:

    package Whatever;

    {
        my $Protected = {};
        sub _initialize
        {
            ....
        }

        sub AltUID
        {
            ....
        }
    }

That way, even code within the module file (but outside the scope of 
those outer braces) can't access the hashref.

> Blurgh. This is why I still think perl5's objects are very broken. The 
> paradigm that 'people messing with your internals should know what 
> they're doing anyway' is fatally flawed - they may know exactly what 
> they're doing - circumventing code you really don't want altered...

But.... they can always alter it.  Even if the source file is in a 
protected directory with restrictive permissions, it still must be read 
in order to be executed.  And therefore anyone can copy its code to their 
own private location, modify it any way they please, and execute it.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP71ymGPeouIeTNHoEQKFtACgmwKTcyPgrH6EDFX1AMb+lxTXkCoAniTU
5eApDoHf3YGY6T2JhyNcJ8gv
=opF0
-----END PGP SIGNATURE-----


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

Date: Thu, 20 Nov 2003 23:58:12 GMT
From: "kbass" <kbass@midsouth.rr.com>
Subject: Re: DBI Question
Message-Id: <oycvb.30938$oC5.21697@clmboh1-nws5.columbus.rr.com>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbrqfro.56k.tadmc@magna.augustmail.com...
> kbass <kbass@midsouth.rr.com> wrote:
>
> > I am receiving a variable from HTML
>
>
> No you're not, as that is impossible.
>
> You meant you are receiving _values_ from a web server, I expect.
>
>
> > use strict
> > ...
> >
> > $territory  = param("STerr");
>
>
> If this is your real code, then where is the declaration
> for that variable (and for all of the others too)?
>
> If this in not your real code, then why is it even here?
>
>
> -- 
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas

No, I posted a snippet of the code. Here is part of the real code if it will
help you.

use DBI qw(:sql_types);
use strict;
use diagnostics; #debugging purposes
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use VCP::Connect;

my (%files,
    $dbh,
    $sth,
    $data,
    @rows,
    $sql,
    $territory,
    $table_name,
    $excel_sheet,
    $output_file,
    $fyear,
    $fqtr,
    $adjtype,
    $adjref,
    $subdist,
    $subdate,
    $aprreason,
    $custid,
    $custname,
    $custtype,
    $adjstatus,
    $declreason,
    $proccomments,
    $dispflag,
    $losingorg,
    $losingterr,
    $gainorg,
     $gainorg,
    $gainterr,
    $revfiltertype,
    $revfilterdesc,
    $adjrevamt,
    $adjpackqty,
    $adjprvyear,
    $adjpackprvyear,
    $adjgoalrevamt,
    $adjgoalvolqty,
    $adjustment
   );

# Autoflush the output buffer
$| = 1;

# Establish database connections for the CompAlign and Sales databases.
$dbh = Connect->compalignDB;

# Check action variable.  If this CGI program is accessed without a
parameter
# within the URL, the default value of 'view' will be given. This is a work
# around that for the '... Use of uninitialized value in string' error
# message.
$territory  = param("STerr");
$table_name = param("table");
$adjustment = param("anbr");

#$territory  = '1-1-1-1-1-2-0';

View_Info();

##############################
# Procedure: View_Info       #
##############################
sub View_Info {

        # IMPORTANT -  This function is for debugging purposes only.
        # Make sure this function is comments after use.
        #unlink 'dbtrace.log' if -e 'dbtrace.log';
        #DBI->trace( 4, 'dbtrace.log' );


        $sql = "select fyear,
                       fqtr,
                       adjtype,
                       adjref,
                       subdist,
                       subdate,
                       aprreason,
                       custid,
                       custname,
                       custtype,
                       adjstatus,
                       declreason,
                       proccomments,
                       dispflag,
                       losingorg,
                       losingterr,
                       gainorg,
                       gainterr,
                       revfiltertype,
                       revfilterdesc,
                       adjrevamt,
                       adjpackqty,
                       adjprvyear,
                       adjpackprvyear,
                       adjgoalrevamt,
                       adjgoalvolqty
                  from fy04q1bulletin
               where subdist = ?
               ";

        $sth = $dbh->prepare($sql);
        my $territory_quoted = $dbh->quote( $territory);
        $sth->execute($territory_quoted);

        $sth->bind_columns(undef, \( $fyear, $fqtr, $adjtype, $adjref,
$subdist,
 $subdate, $aprreason, $custid, $custname, $custtype, $adjstatus,
$declreason, $
proccomments, $dispflag, $losingorg, $losingterr, $gainorg, $gainterr,
$revfilte
rtype, $revfilterdesc, $adjrevamt, $adjpackqty, $adjprvyear,
$adjpackprvyear, $a
djgoalrevamt, $adjgoalvolqty ));

print header;
 ...




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

Date: Fri, 21 Nov 2003 00:09:30 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Image::Magick memory leak question
Message-Id: <bpjl3q$qps$2@wisteria.csv.warwick.ac.uk>


Stan Brown <stanb@panix.com> wrote:
> In <3fbc4f37.145998938@news2.news.adelphia.net>
> posting.account@lynxview.com (William Herrera) writes:
> Yes, it make perfect sense. I was naievly believing that since I had left
> the subroutine, and the $image object was "local" to it, that all traces of
> it would eb retruned to the free pool, as would be done, for non malloced
> memory in C. 
> 
> This seems to be a pretty basic weakness of perl. I wonder if perl6
> addresses this?

No, this is a basic weakness of ImageMagick, or of C. Perl will
correctly tell the Image::Magick object to free itself at the end of
the scope: if it fails to do so correctly, this is not Perl's fault.

Ben

-- 
If I were a butterfly I'd live for a day, / I would be free, just blowing away.
This cruel country has driven me down / Teased me and lied, teased me and lied.
I've only sad stories to tell to this town: / My dreams have withered and died.
  ben@morrow.me.uk   <=>=<=>=<=>=<=>=<=>=<=>=<=>=<=>=<=>=<=>=<=>   (Kate Rusby)


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

Date: Thu, 20 Nov 2003 16:36:40 -0800
From: Tyaan <asdf@asdf.com>
Subject: prevent \\\\ from getting substituted to \ in a system call.
Message-Id: <l2nqrv48osq7fm93qt6k7g9trrckjof5sp@4ax.com>

How can I prevent "\\\\" from getting translated into '\'?

$sm_cmd="psexec \\\\$host -u $userid -p $passwd
c:\\winnt\\temp\\smbios2.exe /a";
$result=`echo $sm_cmd`;
print $result

This is the output.

psexec \an-sm2-g050 -u myuser -p mypass c:winnttempsmbios2.exe /a



 ................................................................
       Posted via TITANnews - Uncensored Newsgroups Access
             >>>> at http://www.TitanNews.com <<<<
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-



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

Date: Fri, 21 Nov 2003 00:43:56 GMT
From: "Alex Lyman" <alex lyman @ earthlink.net>
Subject: Re: prevent \\\\ from getting substituted to \ in a system call.
Message-Id: <gddvb.7588$sb4.5469@newsread2.news.pas.earthlink.net>

> How can I prevent "\\\\" from getting translated into '\'?
>
> $sm_cmd="psexec \\\\$host -u $userid -p $passwd
> c:\\winnt\\temp\\smbios2.exe /a";
> $result=`echo $sm_cmd`;
> print $result
>
> This is the output.
>
> psexec \an-sm2-g050 -u myuser -p mypass c:winnttempsmbios2.exe /a


Technically, it's not.  WinNT/2k/XP's (95/98's might too, can't test from
here, tho) 'echo' command does \ interpolation, too -- it converts the \\
it's being passed into an \ on screen.  You might check to see if your
command is executed correctly -- if not, something else might be wrong.  In
any case, if you need to display correctly with echo, you can use "\\\\\\\\"
instead.

- Alex


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.541 / Virus Database: 335 - Release Date: 11/14/2003




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

Date: Thu, 20 Nov 2003 23:34:19 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Protecting Source code of a perl script
Message-Id: <Pine.LNX.4.53.0311202317260.28058@ppepc56.ph.gla.ac.uk>

On Thu, 20 Nov 2003, Eric J. Roode wrote:

> It may seem unlikely, but nearly every month some white-hat finds and
> reports (or patches) a security hole in sendmail, bind, or any of a
> hundred other unix networking and administration tools.  Often, these are
> professionals who have encountered a problem at work, but often they are
> also hobbyists who are endeavoring to understand the program.

Indeed.  But the causes often prove to be soluble by well-understood
means (I blame a lot of it on C, and its inherent ability to shoot
oneself in the foot, e.g with buffer overflows)

> There is no possibility of such peer-review with, say, Microsoft
> networking and administration tools.  Many bugs are reported, and many
> patches come out.

Indeed.  And within a short time of the fix coming out, a new
compromise of a very similar type is exposed, and a new patch is
circulated, thus revealing that the fundamental underlying problem was
not addressed.  "Papering-over the cracks", so to speak.

As compared with open code, where the discovery of a whole class of
insecurities can be addressed by a solution that demonstrably solves
the whole class of problems (e.g replacing unchecked buffer calls
with checked buffer calls, wherever they occur - not merely the one
instance that was found).

Any software that can, for example, take a MIME content-type of
text/plain, and declare that it contains an attachment, is a risk to
the entire Internet.  I don't see any way around that, other than for
the community to collectively declare the software unfit for use and
take the resulting consequences.

begin  the solution now.

good luck (we need it...)


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

Date: 20 Nov 2003 17:33:52 -0800
From: jwillmore@myrealbox.com (James Willmore)
Subject: Re: Protecting Source code of a perl script
Message-Id: <d61170e5.0311201733.37035649@posting.google.com>

Abigail <abigail@abigail.nl> wrote in message news:<slrnbrpgpe.772.abigail@alexandra.abigail.nl>...
<snip>
> I suggest 'chmod 000 super_secret_program'.

That should be on a t-shirt :-)

Jim
(jwillmore _at_ adelphia _dot_ net)


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

Date: Thu, 20 Nov 2003 19:51:13 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Protecting Source code of a perl script
Message-Id: <Xns9439D440C42Esdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

ctcgag@hotmail.com wrote in news:20031120131044.987$Ih@newsreader.com:

> rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
>> Forget about it.
>>
>> Moreover, security through obscurity just does not work.
> 
> I think security by obscurity is about the only thing that does
> work.  The obscurity of the private key is how public/private key
> systems work.  The obscurity of the password is how most log-on
> authentication systems work.

That is not what is meant by "security by obscurity".  Security by 
obscurity means "I won't share my code/algorithm with you, so you can't 
tell whether it's any good or not."  Not "Here, let's do everything in 
cleartext".

Gnu GPG is completely open-source.  I think kerberos is, too.  So is ssh.  
You're permitted (encouraged!) to examine and evaluate the algorithms and 
the code.  Nobody is suggesting that you leave your keys out in the open.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP71vuWPeouIeTNHoEQLnkwCgvBSwrvkZeRx7p/pNCzLjc8Yu9d4AoM8g
hJypoZydiDlo7awnW+QAeH4Z
=GjeU
-----END PGP SIGNATURE-----


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

Date: 20 Nov 2003 15:42:48 -0800
From: dn_perl@hotmail.com (dn_perl@hotmail.com)
Subject: Reading a flat file into Excel sheet
Message-Id: <97314b5b.0311201542.62a3196a@posting.google.com>

How can I read a flat file into an excel sheet using perl?
If it is possible to do it, I will install both Excel and 
Activestate's perl binaries on my computer.

My flat file has fields of fixed length separated by tabs. Each 
field ends in 'Z'.
Sample :

----------------------------
one    Z	washingtonZ	1788Z
two    Z	adams	  Z	1792Z
sixteenZ	lincoln   Z	1860Z
----------------------------


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

Date: 21 Nov 2003 01:20:06 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Reading a flat file into Excel sheet
Message-Id: <Xns9439CEDD1F093asu1cornelledu@132.236.56.8>

dn_perl@hotmail.com (dn_perl@hotmail.com) wrote in 
news:97314b5b.0311201542.62a3196a@posting.google.com:

> How can I read a flat file into an excel sheet using perl?
> If it is possible to do it, I will install both Excel and 
> Activestate's perl binaries on my computer.
> 
> My flat file has fields of fixed length separated by tabs. Each 
> field ends in 'Z'.
> Sample :
> 
> ----------------------------
> one    Z     washingtonZ     1788Z
> two    Z     adams       Z     1792Z
> sixteenZ     lincoln   Z     1860Z
> ----------------------------

I used something like the following code to convert some Excel sheets to 
plain text. I guess you could use it to do the opposite:

use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;                                # die on errors...

my $open_path = 'C:/Home/';
my $Book = $Excel->Workbooks->Open($open_path.$file);
$Book->Worksheets(1)->SaveAs($save_path.$Book->Worksheets(1)->Name,     
	xlTextMSDOS);
$Book->Close(0);

HTH.

Sinan.
-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Fri, 21 Nov 2003 01:41:35 GMT
From: Dan Anderson <dan@mathjunkies.com>
Subject: Re: Reading a flat file into Excel sheet
Message-Id: <m2he0y33cg.fsf@syr-24-59-76-83.twcny.rr.com>

dn_perl@hotmail.com (dn_perl@hotmail.com) writes:

> How can I read a flat file into an excel sheet using perl?
> If it is possible to do it, I will install both Excel and 
> Activestate's perl binaries on my computer.
> 
> My  flat file has  fields of  fixed length  separated by  tabs. Each
> field ends in 'Z'.  
<snip>

If you read in a file line by line, i.e. like:

use strict;
use warnings;
open ("FILE", "< ./file")
  or die ("Couldn't open the file");
if ((not (-T FILE)) or (not (-r FILE))) {
  die ("The file was either not a text file or not readable");
while ($_ = <FILE>) {
  $_ = chomp ($_);
  check_file($_);
}

You can  split the fields on each  line into an array  using the split
command:

sub check_file {
 my $split_up = shift (@_);
 my @columns = split 'Z', $split_up;
 do_something_with_data(@columns);
}

Now  you can  use  one of  the modules  on  CPAN which  allows you  to
read/write  directly to  an excel  file.  I  forget exactly  what it's
called, but I'm sure if you STW you'll find it. 

-Dan



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5837
***************************************


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