[22426] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4647 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 1 11:05:37 2003

Date: Sat, 1 Mar 2003 08:05:06 -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           Sat, 1 Mar 2003     Volume: 10 Number: 4647

Today's topics:
    Re: Delete a single leading space from a line <garry@ifr.zvolve.net>
        Expression Help <montecristo@nospamspamcop.net>
    Re: Expression Help <wksmith@optonline.net>
    Re: Expression Help <jurgenex@hotmail.com>
    Re: Expression Help <noreply@gunnar.cc>
    Re: Expression Help <dont_mail_me@example.com>
    Re: Expression Help <montecristo@nospamspamcop.net>
    Re: Expression Help <montecristo@nospamspamcop.net>
    Re: Expression Help <montecristo@nospamspamcop.net>
        grep command in a perl script (Bakechad)
    Re: help with printing an array of strings <barryk2@SPAM-KILLER.mts.net>
    Re: How to sort by field in objects? <REMOVEsdnCAPS@comcast.net>
    Re: installing module Win32::SerialPort (Bbirthisel)
    Re: Just a plain Perl manual. But where?? <REMOVEsdnCAPS@comcast.net>
    Re: problem using .htaccess <REMOVEsdnCAPS@comcast.net>
    Re: problem using .htaccess <jurgenex@hotmail.com>
    Re: Reading tab delimited files into a hash. (Charles R. Thompson)
        recursively adding arrays of arrays <jhayden@usa.com>
        Send .tgz files <jaakkke@dontemailme.coma>
    Re: Send .tgz files <me@privacy.net>
    Re: Send .tgz files <jurgenex@hotmail.com>
    Re: Wrap a line at x characters <Jodyman@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 01 Mar 2003 14:41:31 -0000
From: Garry Williams <garry@ifr.zvolve.net>
Subject: Re: Delete a single leading space from a line
Message-Id: <slrnb61hkq.e0t.garry@zfw.zvolve.net>

On 26 Feb 2003 13:25:38 -0800, crivers <Carolyn.Rivers@noaa.gov> wrote:
> If I have a string that contains more than one leading space,
> how can I delete only the first space and keep the remaining spaces?
> The regular expression below deletes all leading spaces:
> 
> $str =~ s/^\s//;
> example:
>       Now is the time    (input string)
> 
> Now is the time          (output string using above RE)
>      
>      Now is the time     (desired output string)
> 
> How do I accomplish this?

  $str = substr $str, 1 if substr $str, 1, 1 eq ' ';

-- 
Garry Williams


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

Date: Sat, 1 Mar 2003 09:47:19 -0500
From:  <montecristo@nospamspamcop.net>
Subject: Expression Help
Message-Id: <MPG.18ca9201c67abd4e98968d@newsgroups.bellsouth.net>

I learning Perl on the fly here so please be kind.
Is there a operator that will fulfill this requirement? "Greater than a 
number, but less than another?"
The problem I'm having with the snipet of code below is that 
"$shipqtysubtotal" will always show up as some number less than 15 if 
"$AllOthers" isn't ordered. I've tried setting "$shipqtysubtotal" to "" 
but that didn't help either.
I don't want to add shipping charges to an item that isn't ordered. 

Any suggestions?  
Thanks.


my ($FlaggedSpecialItems, $FlaggedNoteCards) = (0,0);
	my $AllOthers = "";
	my ($q,$I,$d,$p,$s,$t,);
	my $shipqtysubtotal = "0";
	
		foreach (@orders) {
			($q,$I,$d,$p,$s,$t) = split(/$delimit/);
			$FlaggedSpecialItems += ($q * 10) if ($s == 5);
			$FlaggedNoteCards += ($q * 4) if ($s == 10);
			$AllOthers += $q if ($s == 2);
			}
	

	if ($is_domestic) {

		if  ($I eq 'Custom Work' ) { $shipping = 0 }
		elsif ( $AllOthers <= 15 ) {$shipqtysubtotal = 6.00}
		elsif ( $AllOthers <= 30 ) {$shipqtysubtotal = 7.95}
		elsif ( $AllOthers <= 45 ) {$shipqtysubtotal = 9.95}
		elsif ( $AllOthers <= 60 ) {$shipqtysubtotal = 11.95}
		elsif ( $AllOthers <= 75 ) {$shipqtysubtotal = 13.95}
		elsif ( $AllOthers >  75 ) {$shipqtysubtotal = (.05 * $p)}

		$shipping = ($FlaggedSpecialItems + $FlaggedNoteCards + 
$shipqtysubtotal);

-- 
PLEASE REMOVE "NOSPAM" FROM ADDRESS WHEN REPLYING!!
SPAMMERS MADE ME DO THIS.



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

Date: Sat, 01 Mar 2003 15:25:29 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Expression Help
Message-Id: <Jh48a.635834$HG.117111509@news4.srv.hcvlny.cv.net>


<montecristo@nospamspamcop.net> wrote in message
news:MPG.18ca9201c67abd4e98968d@newsgroups.bellsouth.net...
> I learning Perl on the fly here so please be kind.
> Is there a operator that will fulfill this requirement? "Greater than
a
> number, but less than another?"
> The problem I'm having with the snipet of code below is that
> "$shipqtysubtotal" will always show up as some number less than 15 if
> "$AllOthers" isn't ordered.
--snip--
> if  ($I eq 'Custom Work' ) { $shipping = 0 }

   elsif(!AllOther) {$shipqtysubtotal=0}

> elsif ( $AllOthers <= 15 ) {$shipqtysubtotal = 6.00}
> elsif ( $AllOthers <= 30 ) {$shipqtysubtotal = 7.95}
> elsif ( $AllOthers <= 45 ) {$shipqtysubtotal = 9.95}
> elsif ( $AllOthers <= 60 ) {$shipqtysubtotal = 11.95}
> elsif ( $AllOthers <= 75 ) {$shipqtysubtotal = 13.95}
> elsif ( $AllOthers >  75 ) {$shipqtysubtotal = (.05 * $p)}
-snip--

Add a test for the special case.

Good Luck,
Bill




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

Date: Sat, 01 Mar 2003 15:29:20 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Expression Help
Message-Id: <kl48a.51147$_J5.42248@nwrddc01.gnilink.net>

montecristo@nospamspamcop.net wrote:
> I learning Perl on the fly here so please be kind.
> Is there a operator that will fulfill this requirement? "Greater than
> a number, but less than another?"

If you are searching for an operator you may want to check out the list of
operators in "perldoc perlop".

What's wrong with doing it in two steps:

    if ($num > $x and $num < $y) {
        print "$num is greater than $x and less than $y\n";
    }

jue




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

Date: Sat, 01 Mar 2003 16:32:43 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Expression Help
Message-Id: <b3qkr3$1ov27q$1@ID-184292.news.dfncis.de>

montecristo@nospamspamcop.net wrote:
> I learning Perl on the fly

Exactly what does that mean? Does it mean that you are not willing to 
try solving a problem by studying the docs, FAQs and other sources at 
first hand? In that case you shouldn't count on help in this group.

> Is there a operator that will fulfill this requirement? "Greater than a 
> number, but less than another?"

     $test > $num1 and $test < $num2

Is that what you mean??

/ Gunnar

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



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

Date: Sat, 01 Mar 2003 17:54:08 +0200
From: ilya <dont_mail_me@example.com>
Subject: Re: Expression Help
Message-Id: <newscache$oru2bh$5b7$1@lnews.actcom.co.il>

Bill Smith wrote:
> <montecristo@nospamspamcop.net> wrote in message
> news:MPG.18ca9201c67abd4e98968d@newsgroups.bellsouth.net...
> 
>>I learning Perl on the fly here so please be kind.
>>Is there a operator that will fulfill this requirement? "Greater than
> 
> a
> 
>>number, but less than another?"
>>The problem I'm having with the snipet of code below is that
>>"$shipqtysubtotal" will always show up as some number less than 15 if
>>"$AllOthers" isn't ordered.
> 
> --snip--
> 
>>if  ($I eq 'Custom Work' ) { $shipping = 0 }
> 
> 
>    elsif(!AllOther) {$shipqtysubtotal=0}
> 
> 
>>elsif ( $AllOthers <= 15 ) {$shipqtysubtotal = 6.00}
>>elsif ( $AllOthers <= 30 ) {$shipqtysubtotal = 7.95}
>>elsif ( $AllOthers <= 45 ) {$shipqtysubtotal = 9.95}
>>elsif ( $AllOthers <= 60 ) {$shipqtysubtotal = 11.95}
>>elsif ( $AllOthers <= 75 ) {$shipqtysubtotal = 13.95}
>>elsif ( $AllOthers >  75 ) {$shipqtysubtotal = (.05 * $p)}

I'm sorry, just can't see repeating code.
(I'm not a perl programmer,so pseudocode follows:)

func calc_price(count):
	prices=((15 6.00) (30 7.95) (45 9.95) ...)
	foreach prices as (count_to_check,price):
		if(count<=count_to_check): return price
	# otherwise
	return .05 * count

> 
> -snip--
> 
> Add a test for the special case.
> 
> Good Luck,
> Bill
> 
> 



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

Date: Sat, 1 Mar 2003 10:56:11 -0500
From:  <montecristo@nospamspamcop.net>
Subject: Re: Expression Help
Message-Id: <MPG.18caa221e73620b098968e@newsgroups.bellsouth.net>

In article <kl48a.51147$_J5.42248@nwrddc01.gnilink.net>, 
jurgenex@hotmail.com says...
> montecristo@nospamspamcop.net wrote:
> > I learning Perl on the fly here so please be kind.
> > Is there a operator that will fulfill this requirement? "Greater than
> > a number, but less than another?"
> 
> If you are searching for an operator you may want to check out the list of
> operators in "perldoc perlop".
> 
> What's wrong with doing it in two steps:
> 
>     if ($num > $x and $num < $y) {
>         print "$num is greater than $x and less than $y\n";
>     }
> 
> jue
> 
> 
> 
Thanks, I didn't know you could use "and" as in "if ($num > $x and $num 
< $y)" 
-- 
PLEASE REMOVE "NOSPAM" FROM ADDRESS WHEN REPLYING!!
SPAMMERS MADE ME DO THIS.



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

Date: Sat, 1 Mar 2003 10:56:52 -0500
From:  <montecristo@nospamspamcop.net>
Subject: Re: Expression Help
Message-Id: <MPG.18caa24bc36779198968f@newsgroups.bellsouth.net>

In article <kl48a.51147$_J5.42248@nwrddc01.gnilink.net>, 
jurgenex@hotmail.com says...
> montecristo@nospamspamcop.net wrote:
> > I learning Perl on the fly here so please be kind.
> > Is there a operator that will fulfill this requirement? "Greater than
> > a number, but less than another?"
> 
> If you are searching for an operator you may want to check out the list of
> operators in "perldoc perlop".
> 
> What's wrong with doing it in two steps:
> 
>     if ($num > $x and $num < $y) {
>         print "$num is greater than $x and less than $y\n";
>     }
> 
> jue
> 
> 
> 
Thanks, I didn't know you could use "and" as in "if ($num > $x and $num 
< $y)"
-- 
PLEASE REMOVE "NOSPAM" FROM ADDRESS WHEN REPLYING!!
SPAMMERS MADE ME DO THIS.



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

Date: Sat, 1 Mar 2003 11:02:30 -0500
From:  <montecristo@nospamspamcop.net>
Subject: Re: Expression Help
Message-Id: <MPG.18caa3a5cd7fa106989691@newsgroups.bellsouth.net>

In article <b3qkr3$1ov27q$1@ID-184292.news.dfncis.de>, noreply@gunnar.cc 
says...
> montecristo@nospamspamcop.net wrote:
> > I learning Perl on the fly
> 
> Exactly what does that mean? Does it mean that you are not willing to 
> try solving a problem by studying the docs, FAQs and other sources at 
> first hand? In that case you shouldn't count on help in this group.
> 
It means I'm new. I did study the docs. Just didn't find anything that 
seemed to solve my problem, that's why I asked. Like I said in an 
earlier post, I didn't know you could use "and".
Thanks for your help.



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

Date: 1 Mar 2003 07:58:16 -0800
From: bakechad@ameritech.net (Bakechad)
Subject: grep command in a perl script
Message-Id: <a9c42696.0303010758.4933c272@posting.google.com>

I am new to perl and programming in general.  I grinded out the script
below to convert color files to greyscale.  The script works, but I
would like to ignore the case in my grep statement to pickup files
with both a .jpg & .JPG extension.  I keep trying to add a -i to the
grep statement, but no matter what syntax I try, it does not work.

Thanks

Chad

#!/usr/bin/perl

use warnings;
use strict;
use Image::Magick;

my ($appfile, $extension, $startdir, $destdir, $of, $image, $fname,
$pextension)
;
$appfile = "_bw.";
$extension = "jpg";
my $cl1 = $ARGV[0];
$startdir = "$cl1";
$destdir = "$startdir/bw";
     if (not -d $destdir) {
             mkdir ($destdir);
     }
opendir("photos", $startdir);
my @files = readdir("photos");
closedir("photos");
my @ofs = grep  /.jpg/, @files;

     foreach $of (@ofs) {
($fname, $pextension) = split(/\./, $of);
$image = new Image::Magick;
        $image->Read("$startdir/$of");

$image->Quantize(colorspace=>'gray');

$image->write("$destdir/$fname$appfile$extension");


}


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

Date: Sat, 1 Mar 2003 08:29:47 -0600
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: help with printing an array of strings
Message-Id: <MPG.18ca7fd9f430ed45989726@news.mts.net>


In article <gnO7a.580$%v1.358@newssvr16.news.prodigy.com>, manj dodda 
(dmanjunath@yahoo.com) says...
> I have an array of strings like,
> 
> $array[0] = "my name is Henry" ;
> $array[1] = "What is yours" ;
> $array[2] = "Food" ;
> 
> now i want to print the array with the max len of array[0] which will be
> 16. How do i do it ?.
> 
> my $maxlen = 16 ;
> for($i=0; $i <= $#array ; $i++){
>    printf HANDLE("%s", $array[$i]) ;
> }
> 
> Thanks in advance
> 
> md

# calculate length of longest element in array
$maxlen = (reverse sort { $a <=> $b } map { length $_ } @array)[0];

for ( $i = 0 ; $i <= $#array ; ++$i ) {
    printf HANDLE "%-${maxlen}.${maxlen}s\n",$array[$i];
}


-- 
---------

Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com


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

Date: Sat, 01 Mar 2003 06:14:09 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: How to sort by field in objects?
Message-Id: <Xns933149982953Esdn.comcast@216.166.71.239>

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

TruthXayer <TruthXayer@yahoo.com> wrote in news:3E5FCE46.1E0773B2
@yahoo.com:

> Iain Chalmers wrote:
> 
>> > --
>> > I would like to get a sorted list of objects by "age" ( or by "weight"
>> > ). Is there any built-in function (or package) to do so?
>> 
>> You know, this is just a wild stab in the dark, but do you suppose
>> looking at the doco for the "sort" finction might be worthwhile here?
>> 
>> :-)
> 
> Why dont u make your post worthwhile by cutting and pasting
> "perdoc -f sort" and its output as well?

[snip massive quote from perl docs]

Because it gets really old after a while, spoon-feeding people who don't 
know where to look in the documentation. 

But feel free to do so yourself.  You'll get tired of it the fifth, or the 
tenth, or the twentieth time you post that whole section of the docs.  
Because this question *will* get asked twenty times in the next year.  You 
too will resort to a quick pointer to the docs.

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

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

iQA/AwUBPmCkB2PeouIeTNHoEQLZNQCgzgq6fj6m5390sPLlvo7zWoAZ2iQAn0At
XCBN80eNzoDpnH9Qd8J3+ECt
=lPrJ
-----END PGP SIGNATURE-----


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

Date: 01 Mar 2003 15:17:20 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: installing module Win32::SerialPort
Message-Id: <20030301101720.14408.00000295@mb-fy.aol.com>

Hi,

 >I tried to install the module in Windows 2000 using PPM, and got
>the following message:
>
> Error installing package 'Win32-SerialPort': Read a PPD for 
> 'Win32-SerialPort', but it is not intended for this build of Perl
> (MSW in32-x86-multi-thread)

There are multiple PPDs on the ActiveState site to reflect different Perl
builds. Looks like you got the wrong one.

>Is it a bug, or this module just does not work with the latest
>release of ActivePerl? (perl, v5.6.1 built for MSWin32-x86-multi-thread)

Which is NOT the latest release.

AFAIK, it works with all Perl builds, including non-ActiveState ones,  as long
as you get the matching build on Win32::API. If you have that, you can also
install the CPAN distribution directly without PPM - it is Perl-only. The CPAN
distribution has additional examples as well.

-bill


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

Date: Sat, 01 Mar 2003 06:18:27 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Just a plain Perl manual. But where??
Message-Id: <Xns93314A52A1E0Fsdn.comcast@216.166.71.239>

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

"Peter Cooper" <newsfeed2@boog.co.uk> wrote in
news:71_7a.8391$EN3.64357@newsfep4-glfd.server.ntli.net: 

> I asked this some time back, but isn't there a PDF version of the Perl
> documentation? I'd be surprised if there isn't, but I never stumbled
> across one. Luckily I have enough books already, although a PDF would
> be nice for reference from time to time. Opening up a command prompt
> just to access some documentation seems a bit crude. Better
> suggestions appreciated. 

If I'm going to be referring to a page frequently, or if the page is fairly 
long and/or complex, I run it through pod2html and store it in a 'perldoc' 
directory accessible from my browser. Much easier on the eyes.

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

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

iQA/AwUBPmClDGPeouIeTNHoEQIN4gCgl7Q/QXDITAgg7SsuP8+hfo8jqGMAnRMq
J+bbNafSsBIZLdRgLndp+4Tb
=SJME
-----END PGP SIGNATURE-----


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

Date: Sat, 01 Mar 2003 06:25:02 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: problem using .htaccess
Message-Id: <Xns93314B70071AEsdn.comcast@216.166.71.239>

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

Wd <wdewerff@kc.rr.com> wrote in news:99g06vg9slb2df21perb1fnpmd9l48do4i@
4ax.com:

> I've created a new folder in windows and ftp'd the folder to the nix
> box underneath the web root. I've put both .htaccess and .htpasswd in
> the new folder. The .htaccess has basic authentication with limit get
> and points to the .htpasswd.... /newfolder/.htpasswd. The .htpasswd
> has one user:pass in the file. I put a test file in the same folder,
> and browsed it. I get the authentication box, but it wont accept my
> user and password. I'm still a little green with perl, help?

Green with perl?  Does your question even have anything to DO with perl? :)

I suggest you take your question to a newsgroup that concerns itself with 
apache configuration and security, maybe comp.infosystems.www.something.

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

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

iQA/AwUBPmCmlWPeouIeTNHoEQK/RQCgjYfn870GcTLkyOrqtCuuv+ZyuhcAn2im
G/Yl98+XWI9CUpy8FMJ2OOkP
=8Anu
-----END PGP SIGNATURE-----


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

Date: Sat, 01 Mar 2003 15:36:01 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: problem using .htaccess
Message-Id: <Br48a.51185$_J5.2526@nwrddc01.gnilink.net>

Wd wrote:
> Can I generate an .htpasswd
> file when the web site in question is on a shared box from a hosting
> co?

As far as Perl goes: To create a file just open it:
    open (FILE, ">.htpasswd") or die "Can't open .htpasswd because $!\n";
    close FILE;

Of course this will just create an empty file and you need to decide if this
is appropriate for your application area or if you need to add some content
to this file.

jue




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

Date: 1 Mar 2003 06:01:18 -0800
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Re: Reading tab delimited files into a hash.
Message-Id: <471883c2.0303010601.2186bb69@posting.google.com>

> : my $hostsfile = &read_file('D:/WEB_LOG_PROCESSING/HOSTS.TXT');
> 
> If you must slurp the file (and you probably don't), slurp into an
> array instead of a single scalar.  It will make line-by-line
> processing easier than having to do that s/^CLIENT:....\n// jazz.
> 
>     my @hostsfile = read_file('D:/WEB_LOG_PROCESSING/HOSTS.TXT');

This has been something I've done for awhile and thinking back I
remeber playing with Benchmark and finding the array to be a bit
slower on the processing end of things, especially with large files. I
might be confusing that with something else though. Am I wrong there
on the speed issue?


> Well, the hash slice part is hardly clear there.  It lets you assign a
> list of values to a list of keys.  A simplified example.
> 
>     my %hash;
>     @hash{'key1', 'key2'} = ('value1', 'value2');

Thanks for the follow up. Actually seeing @hash{'key1', 'key2'} =
('value1', 'value2'); in your example code made this alot easier to
grasp.

CT


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

Date: Sat, 01 Mar 2003 13:35:17 GMT
From: "ravlin" <jhayden@usa.com>
Subject: recursively adding arrays of arrays
Message-Id: <pG28a.57211$If5.3162089@twister.southeast.rr.com>

Hi all,

I'm thinking there's an easy solution to this problem.  I've been trying to
come up with it for the last couple days, but haven't been able to.  I'm
trying to write a function that will parse a file. This file contains a list
of tests I want to run.  Everytime it comes to a line with a "{", I want to
start a new array so as I go deeper into blocks of data, I can keep things
sorted out.  I'm probably confusing you, so let me give you an example.
Everything to the right of the # is what I want the value to be in perl.

{                             # $testgroup[0]
    var1=1                # $testgroup[0]{'vars'}[0] = "var1=1"
    var2=2                # $testgroup[0]{'vars'}[1] = "var2=2"
    {                         # $testgroup[0][0]
        {                     # $testgroup[0][0][0]
            var3=3        # $testgroup[0][0][0]{'vars'}[0] = "var3=3"
            {                 # $testgroup[0][0][0][0]
                test1       # $testgroup[0][0][0][0]{'test'}[0] = "test1"
                test2       # $testgroup[0][0][0][0]{'test'}[1] = "test2"
            }
            {                 # $testgroup[0][0][0][1]
            }
        }
        {                     # $testgroup[0][0][1]
            test3           # $testgroup[0][0][1][0]{'test'}[0] = "test3"
            test4           # $testgroup[0][0][1][0]{'test'}[1] = "test4"
        }
    }
}

This is a simple example.  Basically, each test will pick up different
values depending on where they are located in this file.  So the variable
var1 and var2 will be seen by all 4 tests, but var3 will only be seen by
test1 and test2, but not test3 and test4.  So, the scope of each test is
important.  I'm not a great perl programmer so maybe I'm going about it all
wrong and don't want to use arrays of arrays (of hashes).  It seems pretty
straight forward to me looking at the example I have, but I just can't
figure out he code to keep adding on more arrays (and then taking them off
as the blocks close).  Thanks for ANY help or direction you can give me.

Jon




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

Date: Sat, 01 Mar 2003 11:39:48 GMT
From: "Jake" <jaakkke@dontemailme.coma>
Subject: Send .tgz files
Message-Id: <8_08a.7756$Wl3.769880@newsread1.prod.itd.earthlink.net>

How do I, via perl or shell code, attach a .tgz file and email it to
someone?  I'd like to do this hopefully without having to install
third-party .pm modules if possible.  Thanks.




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

Date: Sat, 1 Mar 2003 23:09:33 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: Send .tgz files
Message-Id: <b3q7tu$1oi7ht$1@ID-172104.news.dfncis.de>


"Jake" <jaakkke@dontemailme.coma> wrote in message
news:8_08a.7756$Wl3.769880@newsread1.prod.itd.earthlink.net...
> How do I, via perl or shell code, attach a .tgz file and email it to
> someone?  I'd like to do this hopefully without having to install
> third-party .pm modules if possible.  Thanks.

You can either make it very easy or difficult on yourself.

If you want to go down the easy route, use the MIME::Lite module.

If you want to do it the hard way, study up all the relevant RFC's on mail,
MIME and SMTP.




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

Date: Sat, 01 Mar 2003 15:38:19 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Send .tgz files
Message-Id: <Lt48a.51199$_J5.49696@nwrddc01.gnilink.net>

Jake wrote:
> How do I, via perl or shell code, attach a .tgz file and email it to
> someone?  I'd like to do this hopefully without having to install
> third-party .pm modules if possible.  Thanks.

And why are you multi-posting this question?

Please see my answer in the other NG (I hope you still remember all the NGs
where you posted this; good luck in collecting the replies).

jue




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

Date: Sat, 01 Mar 2003 13:19:05 GMT
From: "Jodyman" <Jodyman@hotmail.com>
Subject: Re: Wrap a line at x characters
Message-Id: <dr28a.7788$Wl3.779567@newsread1.prod.itd.earthlink.net>

"Sean" <bhjp@spookyworld.dnsalias.com> wrote in message

> This is probably a simple regex problem, but I'm not sure how to approach
> it. I have a string of text, say 128 characters long and I'm looking to
> insert line breaks every x characters. Could someone clue me in on how I
> may accomplish this?

Use Text::Wrap or roll your own.  Maybe something like this:

#use warnings;        #you will receive one warning: Use of uninitialized
value in length at textwrap.pl line xx.
use strict;

my ($activity, $col, @text, $text, $temp);

$activity = "This is what we will be doing at the activity and a description
of what it is.  Just alot of rambling so I can have at least 128 characters
on any one line.  Or maybe not?  Let's see if this works now.  Blah, Blah,
Blah.  I also appended a space to the beginning of the text so the text
wouldn't be next to the table wall on the calendar the text was printing in.
Just a little formatting.";

$col = 128;
@text = split / /, $activity, ;

  for $text (@text) {
# Take away <br> if not for html #####################
   if (length($text) == $col || length($text) > $col) {print "$text<br>\n";}
   else {
    if ( length($temp)+length($text)+1 > $col) {print
"$temp<br>\n";$temp="";$temp =$temp . " $text";}
    else { $temp =$temp . " $text";}
   }

  }
  if ($temp) {print "$temp<br>\n";$temp="";}

#Hope this helps
#Jody




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

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


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