[17599] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5019 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 3 06:05:36 2000

Date: Sun, 3 Dec 2000 03: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)
Message-Id: <975841506-v9-i5019@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 3 Dec 2000     Volume: 9 Number: 5019

Today's topics:
    Re: Anonymous Array Reference ?? (OTR Comm)
    Re: Anonymous Array Reference ?? (OTR Comm)
    Re: Anonymous Array Reference ?? <ron@savage.net.au>
        DBD::CSV or TEXT::CSV <chris@grrn.org>
    Re: Grappling wth space (Mark Ferguson)
    Re: HELP! bring variables out of a subroutine? <guymal@hotmail.com>
        How to do the equivalent of isatty()? ()
    Re: How to do the equivalent of isatty()? <krahnj@acm.org>
    Re: I Have Active Perl--Now What? <mtn_view@sirius.com>
    Re: I Have Active Perl--Now What? <Petri_member@newsguy.com>
        JAPH in Befunge <jeffp@crusoe.net>
        learning perl, this does not work ... why? <jfdecd@execpc.com>
        learning perl, this does not work ... why? <jfdecd@execpc.com>
        learning perl, this does not work ... why? <jfdecd@execpc.com>
    Re: Network "Discovery" (Homer Simpson)
        progress of upload using multipart/form-data yaronn@my-deja.com
        question about matching... ivolla@my-deja.com
    Re: question about matching... <Jodyman@usa.net>
        Why do only some files truncate? <tim@commotion.net.au>
    Re: Why do only some files truncate? (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 03 Dec 2000 05:56:54 GMT
From: otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net (OTR Comm)
Subject: Re: Anonymous Array Reference ??
Message-Id: <3a29dce1.3662186776@news.wildapache.net>

Hello,

Thanks for the reply, but ...

On Sun, 3 Dec 2000 13:27:34 +1100, "Ron Savage" <ron@savage.net.au>
wrote:

>Tested code:
>
>#!perl
>
>use integer;
>use strict;
>use warnings;
>
># -------------------------------------------
>
>my(@id, %name);
>
>while (<DATA>)
>{
> chomp;
> my($id, $name) = split(/\s*=>\s*/, $_);
> push(@id, $id);
> $name{$id} = $name
>}
>
>print "Ids: \n";
>print map{"\t$_. \n"} @id;
>print "\n";
>print "Names: \n";
>print map{"\t$_ => $name{$_}. \n"} sort {$name{$a} cmp $name{$b} } keys
>%name;
>print "\n";
>
>__END__
>one=>Visa
>two=>Master Card
>three=>Discover
>four=>American Express

I guess I am not sure what you are telling me here.  I apologize for my
ignorance, but how does this relate to my original question?  That is,
does the code that you have here convert the string "[qw(one two three
four)]" into a form that is usable by the -values=> definition in a
popup_menu structure?

Thanks,
Murrah Boswell
>
>
>
>--
>Cheers
>Ron  Savage
>ron@savage.net.au
>http://savage.net.au/index.html
>OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net> wrote in message
>news:3a297046.3634383928@news.wildapache.net...
>> Hello,
>>
>> This is probably a strange question, but I need to figure something out.
>>
>> I have some code:
>>
>> $card_values = [qw(one two three four)];
>> $card_default = qq(one);
>> %card_types = ('one'=>'Visa','two'=>'Master
>Card','three'=>'Discover','four'=>'American Express');
>>
>> print out "\ncard_values = $card_values, card_values0 =
>@$card_values[0]\n\n" if ($DEBUG gt 0);
>>
>> print $query->popup_menu(-name=>'card_type',
>>                                 -values=>$card_values,
>>                                 -default=>$card_default,
>>                                 -labels=>\%card_types),
>>
>> that works fine.
>>
>> However, I would like to be able to read in $card_values from an external
>configuration file and the
>> have the popup_menu contain the correct 'values'.
>>
>> I have an external configuration file where I DO predefine variables
>(i.e., $var1 = "something') and
>> then can access the value of $var1 in my script.  However, when I include
>$card_values = [qw(one two
>> three four)]; in my configuration file and try to access $card_values in
>my script, I just get the
>> string [qw(one two three four)], not the reference to the anonymous array.
>>
>> Does anyone know how perl interprets the statement:
>>
>> $card_values = [qw(one two three four)];
>>
>> and how I can get it to interpret:
>>
>> $card_values = "[qw(one two three four)]";
>>
>> the same way?
>>
>> I hope this make some sense.
>>
>> Thanks,
>> Murrah Boswell
>
>



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

Date: Sun, 03 Dec 2000 06:18:41 GMT
From: otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net (OTR Comm)
Subject: Re: Anonymous Array Reference ??
Message-Id: <3a29e34a.3663827615@news.wildapache.net>

Hello,

>my $ra = eval $value;		       # reference to array.

Thanks!  That did it!

I tried:

#!/usr/bin/perl

$card_values = "[qw(one two three four)]";
$card_values = eval $card_values;
print "\ncard_values_0 = @$card_values[0]\n" ;
__END__

card_values_0 = one

So, thanks alot!
Murrah Boswell

On Sun, 03 Dec 2000 01:36:01 GMT, Vinny Murphy
<VincentMurphy@mediaone.net> wrote:

>>>>>> "OTR" == OTR Comm <otrcomm> writes:
>
>    OTR> On Sat, 02 Dec 2000 23:44:55 GMT, tom.hoffmann@worldnet.att.net
>    OTR> (Tom Hoffmann) wrote:
>
>    >> On Sat, 02 Dec 2000 22:25:42 GMT, OTR Comm wrote:
>    >>> Hello,
>    >>> 
>    >>> This is probably a strange question, but I need to figure something
>    >>> out.
>    >>> 
>    >>> I have some code:
>    >>> 
>    >>> $card_values = [qw(one two three four)]; $card_default = qq(one);
>    >>> %card_types = ('one'=>'Visa','two'=>'Master
>    >>> Card','three'=>'Discover','four'=>'American Express');
>    >>> 
>    >>> print out "\ncard_values = $card_values, card_values0 =
>    >>> @$card_values[0]\n\n" if ($DEBUG gt 0);
>    >>> 
>    >>> print $query->popup_menu(-name=>'card_type', -values=>$card_values,
>    >>> -default=>$card_default, -labels=>\%card_types),
>
>    >>  Why don't you print out the value of $card_values, then you would
>    >> know how perl interprets the statement. Here is what I got:
>    >> 
>    >> ++++++++++++++++++++++++++++++++++++ #!/usr/bin/perl -w use strict;
>    >> 
>    >> my $cards = [qw(one two three four)]; print "$cards\n";
>    >> +++++++++++++++++++++++++++++++ [tom@localhost other]$ ./test.pl
>    >> ARRAY(0x80f86e0) +++++++++++++++++++++++++++++++
>    >> 
>    >> So $cards is a reference to an anonymous array, no?
>    >> 
>    >> $cards->[0]=one $cards->[1]=two $cards->[2]=three $cards->[3]=four
>    >> 
>    >> Does this help?
>
>    OTR> No, I have done this already!
>
>    OTR> What I need to do I guess is know how to expand [qw(one two three
>    OTR> four)] into a variable when it is embedded in a string and then
>    OTR> have perl intrepret the resultant variable into a hash.
>
>
>    OTR> For example, say I have a string "This is the hash: [qw(one two
>    OTR> three four)]", how can I parse [qw(one two three four) out of the
>    OTR> string into a variable, say $card_values and then use $card_values
>    OTR> in my popup_menu structure?
>
>I not sure this is what you want.  If you want to embed a reference to an
>array in a string than this may be what you are looking for:
>
>my $string = 'This is the hash: [qw(one two three four)]';
>
># how you get the [ qw(one two ..) is up to you. TMTOWTDI
>my $value = (split ': ', $string)[-1]; 
>my $ra = eval $value;		       # reference to array.
>print join(", ", @$ra), ".\n";	       # show array.
>
>
>HTH,
>
>--vjm
>



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

Date: Sun, 3 Dec 2000 22:11:32 +1100
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Anonymous Array Reference ??
Message-Id: <V%oW5.1218$K02.36648@ozemail.com.au>

Murrah

What I am saying is that you have asked the wrong question. That is, by
casting it as a problem on how to handle a string like: "[qw(one two three
four)]" you are making things extra-ordinarily difficult for yourself. Your
data structure is ridiculous in this context.

You need to recast the question, along the lines of: What data structure
suits this situation?

So, my reply has 2 aspects:
(1) Get the data from outside the code. Eg: Read it in just like you
originally said you wanted to do.
(2) Store the data in a convenient form. Eg:
My version of CGI.pm looks like this (p 245 of Lincoln Stein's book), with
various corrections by me:
(a) Make the entire parameter list an anonymous hash, since that's what
_invariably_ works for me
(b) Remove those ghastly leading minus signs on the parameters. They're
redundant line-noise, and what's worse, they're crap
(c) Remove the redundant single quotes inside the anonymous hash pointed to
by labels, since => is a quoting operator (it quotes the thing on it's left)

(Lincoln must have dozed off while writing this chapter :-)

Hence our prototype is:

print $q -> popup_menu
({
    name => 'pick_one',
    values => ['eenie', 'meenie', 'minie'],
    default => 'meenie',
    labels => {eenie => 'one', meenie => 'two', minie => 'three'}
});

But wait, what's this!? An anonymous array and an anonymous hash!
Jeeeeeeez - what a coincidence! That's just what my code gives you. Thusly:

print $q -> popup_menu
({
    name => 'pick_one',
    values => \@id,
    default => 'meenie',
    labels => \%name
});

_Now_ you're a happy little vegemite...

--
Cheers
Ron  Savage
ron@savage.net.au
http://savage.net.au/index.html
OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net> wrote in message
news:3a29dce1.3662186776@news.wildapache.net...
> Hello,
>
> Thanks for the reply, but ...
>
> On Sun, 3 Dec 2000 13:27:34 +1100, "Ron Savage" <ron@savage.net.au>
> wrote:
>
> >Tested code:
> >
> >#!perl
> >
> >use integer;
> >use strict;
> >use warnings;
> >
> ># -------------------------------------------
> >
> >my(@id, %name);
> >
> >while (<DATA>)
> >{
> > chomp;
> > my($id, $name) = split(/\s*=>\s*/, $_);
> > push(@id, $id);
> > $name{$id} = $name
> >}
> >
> >print "Ids: \n";
> >print map{"\t$_. \n"} @id;
> >print "\n";
> >print "Names: \n";
> >print map{"\t$_ => $name{$_}. \n"} sort {$name{$a} cmp $name{$b} } keys
> >%name;
> >print "\n";
> >
> >__END__
> >one=>Visa
> >two=>Master Card
> >three=>Discover
> >four=>American Express
>
> I guess I am not sure what you are telling me here.  I apologize for my
> ignorance, but how does this relate to my original question?  That is,
> does the code that you have here convert the string "[qw(one two three
> four)]" into a form that is usable by the -values=> definition in a
> popup_menu structure?
>
> Thanks,
> Murrah Boswell
> >
> >
> >
> >--
> >Cheers
> >Ron  Savage
> >ron@savage.net.au
> >http://savage.net.au/index.html
> >OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net> wrote in
message
> >news:3a297046.3634383928@news.wildapache.net...
> >> Hello,
> >>
> >> This is probably a strange question, but I need to figure something
out.
> >>
> >> I have some code:
> >>
> >> $card_values = [qw(one two three four)];
> >> $card_default = qq(one);
> >> %card_types = ('one'=>'Visa','two'=>'Master
> >Card','three'=>'Discover','four'=>'American Express');
> >>
> >> print out "\ncard_values = $card_values, card_values0 =
> >@$card_values[0]\n\n" if ($DEBUG gt 0);
> >>
> >> print $query->popup_menu(-name=>'card_type',
> >>                                 -values=>$card_values,
> >>                                 -default=>$card_default,
> >>                                 -labels=>\%card_types),
> >>
> >> that works fine.
> >>
> >> However, I would like to be able to read in $card_values from an
external
> >configuration file and the
> >> have the popup_menu contain the correct 'values'.
> >>
> >> I have an external configuration file where I DO predefine variables
> >(i.e., $var1 = "something') and
> >> then can access the value of $var1 in my script.  However, when I
include
> >$card_values = [qw(one two
> >> three four)]; in my configuration file and try to access $card_values
in
> >my script, I just get the
> >> string [qw(one two three four)], not the reference to the anonymous
array.
> >>
> >> Does anyone know how perl interprets the statement:
> >>
> >> $card_values = [qw(one two three four)];
> >>
> >> and how I can get it to interpret:
> >>
> >> $card_values = "[qw(one two three four)]";
> >>
> >> the same way?
> >>
> >> I hope this make some sense.
> >>
> >> Thanks,
> >> Murrah Boswell
> >
> >
>




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

Date: Sun, 3 Dec 2000 02:52:24 -0500
From: "Chris Sparnicht" <chris@grrn.org>
Subject: DBD::CSV or TEXT::CSV
Message-Id: <vXmW5.24757$yP6.119610@news2.atl>

Greetings:

I'm new to perl and DBI and still learning, so
please bare with me. :o)

1. I have a virtual site on a unix machine, but
I don't seem to have write access via mySQL from my site
because I haven't been granted a login or password to the
SQL host. (I will not be asking for a login or password.)
I can however, read any mySQL file on the server,
so I seem to have limited access to the following:
DBD::ADO
DBD::ExampleP
DBD::mysql
DBD::NullP
DBD::Proxy
DBD::Sponge
DBI
DBI::FAQ
DBI::Format
DBI::ProxyServer
DBI::Shell

2. DBD::CSV does not exist on the the server. Before I ask
my host to install DBD::CSV, will I still need login and password
to the host or does DBD::CSV allow you to specify files
on my site to write/view without a login? I don't want to waste my time
exploring this avenue if I will only once again have read access
to my data from DBI. If it is installed, will I be able to specify
document paths to specific databases I want to create/use?

3. I don't have TEXT::CSV available either. Is this an alternative
worth asking for?

Chris




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

Date: 3 Dec 2000 02:21:10 -0800
From: mefergus@Stanford.EDU (Mark Ferguson)
Subject: Re: Grappling wth space
Message-Id: <90d6qm$o5d@GSB-Kwanza.Stanford.EDU>

Martien Verbruggen <mgjv@tradingpost.com.au> writes:
>On 2 Dec 2000 12:09:34 -0800,
>	Mark Ferguson <mefergus@Stanford.EDU> wrote:
>
>> How about
>> 
>>    s/^\s+|\s+$//g;  # leading and trailing space in one go
>
>The FAQ specifically states that it is much faster to do this in two
>steps. The OP has a better solution than yours for this.

I stand corrected.

>
>>    s/[,\s+]+/ /g;   # commas and more than one space get one space
>
>This doesn't answer the OP's question. What are that comma and plus
>doing in there, and why are you getting rid of them? Besides that, your
>comment is misleading. The above substitution will replace every
>sequence of 1 or more commas, whitespace or the plus character with a
>single space.

Uhh, uhh, not enough coffee? My apologies -- I did
not mean to treat the "+" so roughly.

I was tempted to suggest using split and join to
handle all the white space issues and then I notice
he is removing commas as well -- not stated in his
algorithm but in his commenatry.  To that end, I
*meant* to suggest

    s/[,\s]+/ /g;

So that "   Big, bad, and    fuzzy  " ends up as 
"Big bad and fuzzy".

>
>$ perl
>$_ = '+,    ,+   ,+';       
>s/[,\s+]+/ /g;
>print "'$_'\n";
>__END__
>' '
>
>I doubt very much that that was what was wanted.
>

Indeed.



-- 
Mark Ferguson <Mark.Ferguson@Stanford.EDU> 


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

Date: Sun, 3 Dec 2000 10:35:33 +0200
From: "Guy" <guymal@hotmail.com>
Subject: Re: HELP! bring variables out of a subroutine?
Message-Id: <3a2a0583@news.barak.net.il>

You can always pass variables by reference, then you don't have to worry
about returning many variables.
<webbgroup@my-deja.com> wrote in message news:8vggf8$iah$1@nnrp1.deja.com...
> What happens when I have multiple variables. Can I return all of those??
>
> sub mysub
> {
>   my $str="Hello, World!";
>   $addition= 5+7;
>   return $str,$addition;
> )
>
> NEVERMIND ... I DID IT..AND IT WORKED. THANKS GUYS..
>
>
> > In perl everything is rather different.
> >
> > sub mysub{
> >   my $str="Hello, world!";
> >   return $str;
> > }
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: 3 Dec 2000 09:15:07 GMT
From: kmead@socrates.Berkeley.EDU ()
Subject: How to do the equivalent of isatty()?
Message-Id: <90d2ur$q45$1@agate.berkeley.edu>

Is there a cross-platform way of a doing the equivalent of isatty()?
I want to know if stdin has been redirected from a file or not.

Thanks
Keith


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

Date: Sun, 03 Dec 2000 09:23:45 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: How to do the equivalent of isatty()?
Message-Id: <3A2A11D1.9074F7E8@acm.org>

kmead@socrates.Berkeley.EDU wrote:
> 
> Is there a cross-platform way of a doing the equivalent of isatty()?
> I want to know if stdin has been redirected from a file or not.

if ( -t STDIN )

John


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

Date: Sat, 02 Dec 2000 21:21:12 -0800
From: Wayne Watson <mtn_view@sirius.com>
Subject: Re: I Have Active Perl--Now What?
Message-Id: <3A29D848.E8997F3F@sirius.com>

Thanks for your response. Mr. Bowman sent me an excerpt from the doc (also known as TFM) and some
instructions on how to find it; however, something is amiss. Maybe I misunderstood his directions,
but his menu items did not correspond to what I see.. I'm waiting for a reply from him regarding
this. My ActivePerl is version 5.22. I still have yet to find explicit instructions on how to fire
up perl in the doc. However, I found a tutorial and it illustrated how to use it with DOS. I did
this successfully.

I'm assuming that by the second link you mean "Getting Started". "Getting Started" has submenus:
Welcome, Release Notes, Install Notes, Readme and Dir Structure.  I see nothing in Welcome that
pertains to using DOS, etc. Ah, ha!!!! I think I just found what I should have found earlier. It's
in Readme. Maybe it was moved to another location in later AP release. Frankly, putting that info in
Readme is, I say charitably, lame. In fact, I'll repeat it. That's lame. Geeze.

I confused myself over the uninstall. Add/Remove does have an entry for AP. Only moments before
installing AP, I was trying to figure out how to uninstall NT Resource Toolkit. It has no entry in
Add/Remove and no entry in the Start menu. Anyway, I was mistaken about a facility for not being
able to remove AP.

I don't recall what rights I installed AP with, but I'm always in Admin mode when I operate NT.

I'm using NT 4.0.

Petri Oksanen wrote:

> In article <3A292BDF.148F0702@sirius.com>, Wayne says...
> >> I usually go to a DOS box and do 'perl foobar.pl' but if you
> >> RTFM that came with the AP installation, you'll find out how
> >> to associate the extension so you could just click on the
> >> script, if that fluffs your fur.
>
> > I'd like to see you find that in TFM that is provided with the
> > package.
>
> Are you are talking about associating the Perl interpreter to files with
> extension .PL?
> Unless you yourself unchecked that option during the installation, file
> association has already been done for you.
> An exception to the rule, according to TFM, is if you installed Perl without
> administrative rights on your system. In that case file association will be
> disabled.
>
> > Just copy the section and send it to me as proof that it is
> > in TFM.
>
> ActivePerl has installed a massive set of documentation on your system.
> Learn to use it and search in it as soon as you can, you will soon discover what
> a great resource it really is.
> As for this specific info, it is mentioned in the second link from the top in
> the navigation.
>
> Also, check out perlwin32, where it is mentioned that assoc.exe can be used to
> create associations on NT.
> Another way would be to just doubleclick some file of unknown type and
> immediately choose what app to associate it with.
> Remember to be logged in with admin rights.
>
> > 1. Is the only item in the Start menu ActivePerl->Online
> > Documentation?
>
> Yes.
> It's the only one you need!
>
> > 2. How does one uninstall ActivePerl?
>
> Go to "Add/Remove Programs" in the Control Panel.
> Are you having problems?
> What version of ActivePerl did you install and what system are you running?
> Win2K?
> Win9x?
> If WinNT4, what Service Pack? (check with Start->Run->winver)
>
> Petri Oksanen

--
                              "It's better to wear out than rust out"
                                 -- Theodore Roosevelt, 26th U.S. President

                                            Wayne T. Watson




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

Date: 2 Dec 2000 23:14:44 -0800
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: I Have Active Perl--Now What?
Message-Id: <90crt401v2o@edrn.newsguy.com>

In article <3A29D848.E8997F3F@sirius.com>, Wayne says...
> Maybe I misunderstood his directions, but his menu items did
> not correspond to what I see..

> My ActivePerl is version 5.22.

That's Perl V5.005_3, ActivePerl binary build # 522.

> I still have yet to find explicit instructions on how to fire
>up perl in the doc.

> I'm assuming that by the second link you mean "Getting Started".

No, you have an old version of the ActivePerl documentation, the links are
different now.
ActivePerl with buildnumbers in the 600's is Perl V5.6.0, the current version of
Perl.

> I still have yet to find explicit instructions on how to fire
> up perl in the doc.

I'm not sure I understand what it is you expect to find.
Perl does not come with its own IDE (-Yet, go look at what ActiveState are
cooking up), nor does it really need one.
Just write your script in any texteditor, use Notepad if you don't have anything
better.
Save the file as <whatever>.pl, and doubleclick the file in Explorer to run it.
That's it.
Are you planning to use Perl for CGI?
If you already have IIS and a sufficiently modern Service Pack installed, you
will have installed all the integrated support for IIS and the ActiveX-support
already (unless you unchecked those options).
Follow the instructions in the documentation to associate some file extension in
IIS with the Perl interpreter, preferrably .PL or maybe .CGI for obscurity.

Usually you will want to run your script from the command prompt, it's just
easier that way.
You are not running it in DOS, because the NT VDM is never invoked.
ActivePerl is a native Win32 app and runs in the 32bit command interpreter when
run from the prompt.

I suggest you get hold of some nice programming editor with support for Perl, it
will really help.
You'll get syntax highlighting and the ability to execute your scripts directly
from the editor. You'll find lots of suggestions on that and much more at
http://www.perl.com/

> Frankly, putting that info in Readme is, I say charitably, lame.
> In fact, I'll repeat it. That's lame. Geeze.

You still haven't read perlwin32, have you?
I guess I have to repeat myself: _Everything_ is in the docs.
Learn the structure so you start finding what you want in it.
Use the perldoc tool (from the command prompt) to quickly look up specific parts
of any documentation.
If textbased shells scare you, just stick with the html version.
Just remember that if someone in this group points you to, for example:
perldoc -q windows
or
perldoc perlwin32

They actually expect you to type that line at the prompt.

Good luck now, and happy hacking.


Petri Oksanen



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

Date: Sun, 3 Dec 2000 01:08:26 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: JAPH in Befunge
Message-Id: <Pine.GSO.4.21.0012030101250.5826-100000@crusoe.crusoe.net>

vv<vr'< x 1 -10<      I started learning
 # #   '  ; ,_@#:<;   Befunge yesterday,
>0'r "ekcaH l"v#      and already, I'm
 >#\#1'P" r"   ^      writing JAPHs in it.
  ^<0 ^       <       What a messed-up,
   x"htonA tsuJ" ^    beautiful language.

Or, the shortest possible JAPH:

0"rekcaH lreP rehtonA tsuJ">:#,_@

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/





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

Date: Sun, 03 Dec 2000 04:10:26 +0600
From: "Jerry" <jfdecd@execpc.com>
Subject: learning perl, this does not work ... why?
Message-Id: <3a2a1010$0$30003$6d6c75b@news.execpc.com>

Hey all:

I am just learning perl. I have perl 5.6.0 for i686-linux

I put in the following script (from Beginning perl by Simon Cozens)
expecting the $1 .. $5 variables to print something.
I get the first print line, "The text matches ...", but do not get
anything for $1 as I expected.

why?

Thanks,
Jerry


#!/usr/bin/perl

use warnings;
use strict;

$_ = '1: A silly sentence (495,a) *BUT* one which will be useful. (3)';

print "enter a regular expression: ";
my $pattern = <STDIN>;
chomp $pattern;

if (/$pattern/) {
  print "The text matches the pattern '$pattern'.\n";
  print "\$1 is '$1'\n" if defined $1;
  print "\$2 is '$2'\n" if defined $2;
  print "\$3 is '$3'\n" if defined $3;
  print "\$4 is '$4'\n" if defined $4;
  print "\$5 is '$5'\n" if defined $5;
}
else {
  print "'$pattern' was not found.\n";
}


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

Date: Sun, 03 Dec 2000 04:23:32 +0600
From: "Jerry F. Davis" <jfdecd@execpc.com>
Subject: learning perl, this does not work ... why?
Message-Id: <3a2a1323$0$35010$6d6c75b@news.execpc.com>

Hey all:

I am just learning perl. I have perl 5.6.0 for i686-linux

I put in the following script (from Beginning perl by Simon Cozens)
expecting the $1 .. $5 variables to print something.
I get the first print line, "The text matches ...", but do not get
anything for $1 as I expected.

why?

Thanks,
Jerry


#!/usr/bin/perl

use warnings;
use strict;

$_ = '1: A silly sentence (495,a) *BUT* one which will be useful. (3)';

print "enter a regular expression: ";
my $pattern = <STDIN>;
chomp $pattern;

if (/$pattern/) {
  print "The text matches the pattern '$pattern'.\n";
  print "\$1 is '$1'\n" if defined $1;
  print "\$2 is '$2'\n" if defined $2;
  print "\$3 is '$3'\n" if defined $3;
  print "\$4 is '$4'\n" if defined $4;
  print "\$5 is '$5'\n" if defined $5;
}
else {
  print "'$pattern' was not found.\n";
}


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

Date: Sun, 03 Dec 2000 04:52:36 -0600
From: "Jerry F. Davis" <jfdecd@execpc.com>
Subject: learning perl, this does not work ... why?
Message-Id: <3a2a19f3$0$35011$6d6c75b@news.execpc.com>

Hey all:

I am just learning perl. I have perl 5.6.0 for i686-linux

I put in the following script (from Beginning perl by Simon Cozens)
expecting the $1 .. $5 variables to print something.
I get the first print line, "The text matches ...", but do not get
anything for $1 as I expected.

why?

Thanks,
Jerry


#!/usr/bin/perl

use warnings;
use strict;

$_ = '1: A silly sentence (495,a) *BUT* one which will be useful. (3)';

print "enter a regular expression: ";
my $pattern = <STDIN>;
chomp $pattern;

if (/$pattern/) {
  print "The text matches the pattern '$pattern'.\n";
  print "\$1 is '$1'\n" if defined $1;
  print "\$2 is '$2'\n" if defined $2;
  print "\$3 is '$3'\n" if defined $3;
  print "\$4 is '$4'\n" if defined $4;
  print "\$5 is '$5'\n" if defined $5;
}
else {
  print "'$pattern' was not found.\n";
}


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

Date: 3 Dec 2000 05:28:16 GMT
From: homer.simpson@springfield.nul (Homer Simpson)
Subject: Re: Network "Discovery"
Message-Id: <90cllg$47k$0@216.39.130.48>

In article <3a26c222.7446667@news.junction.net>, tmills@total-care.com wrote:
>I want to write a Perl script that will find the NetBIOS names of all
>computers on the network. Either through some sort of broadcast or by
>accessing Server Manager on one of our NT boxes. I've looked on CPAN

use system or qx to run the NT system command NET.exe with the "view" 
parameter

        net view

will show all server names in the format:
Servername[white space]optional comment
\\Server_A                      Email server
\\OtherServer                  Bob's machine
\\MyComputer            

using the NT for command will allow you to parse out the \\ and other stuff

for /?  help with the for command
net /?  help with net.exe





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

Date: Sun, 03 Dec 2000 10:07:54 GMT
From: yaronn@my-deja.com
Subject: progress of upload using multipart/form-data
Message-Id: <90d61p$nvb$1@nnrp1.deja.com>

Does anyone have an idea how to get the progressive length (bytes)
of a file uploaded using CGI.pm by multipart/form-data?

If it's not possible using CGI.pm, how is it done,
and do I have to parse the query string as well?
(or leave that to CGI.pm)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 03 Dec 2000 08:29:37 GMT
From: ivolla@my-deja.com
Subject: question about matching...
Message-Id: <90d09g$kfo$1@nnrp1.deja.com>

I am trying to make a script to search through a list of names and see
if a certain name is in there. The list is set up to show:
First Name: xxxxLast Name: xxxxx
First Name: xxxxLast Name: xxxxx

the code i have written is:

open (FILE, '/home/httpd/cgi-bin/volla/list.txt');
if (<FILE> =~ m/First Name: $FORM{'firstname'}Last Name: $FORM
{lastname}/i)
{
print "match";
close FILE;
}

This will find the first name but not the last. Is m// limited to one
variable? Any help on why this won't work or a better way would be
appreciated. Thanks in advance.




Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 3 Dec 2000 04:51:20 -0500
From: "Jody Fedor" <Jodyman@usa.net>
Subject: Re: question about matching...
Message-Id: <90d5h9$dcp$1@plonk.apk.net>


ivolla@my-deja.com wrote in message <90d09g$kfo$1@nnrp1.deja.com>...
>I am trying to make a script to search through a list of names and see
>if a certain name is in there. The list is set up to show:

>if (<FILE> =~ m/First Name: $FORM{'firstname'}Last Name: $FORM{lastname}/i)


^              ^

                                       $FORM{'lastname'}

You only give it a First Name!

>{
>print "match";
>close FILE;
>}





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

Date: Sun, 03 Dec 2000 06:54:50 GMT
From: "Tim Shepherd" <tim@commotion.net.au>
Subject: Why do only some files truncate?
Message-Id: <_6mW5.2331$xW4.23204@news-server.bigpond.net.au>

As a relative newbie I seem to be having a few problems with a script to
send binary files via a form on the web.

The script is called formhandler.pl (from  www.cgi-perl.com). I am running
this on an NT box running ActiveState perl 5. The funny thing is the email
gets sent along with the base64 encoding but if the file is a PDF or ZIP or
EXE the file is truncated to only a few KB. But if the file is an RTF
document the whole file comes through and attaches fine. Is the script the
problem or is it  SMTP server that I use to send the file?

goto www.daa.gov.au/test2.html to see the form itself.  If anybody has any
suggestions etc please help!

Thanks

Tim Shepherd




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

Date: Sun, 3 Dec 2000 18:34:17 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Why do only some files truncate?
Message-Id: <slrn92jtrp.20m.mgjv@martien.heliotrope.home>

On Sun, 03 Dec 2000 06:54:50 GMT,
	Tim Shepherd <tim@commotion.net.au> wrote:

> The script is called formhandler.pl (from  www.cgi-perl.com). I am running
> this on an NT box running ActiveState perl 5. The funny thing is the email
> gets sent along with the base64 encoding but if the file is a PDF or ZIP or
> EXE the file is truncated to only a few KB. But if the file is an RTF
> document the whole file comes through and attaches fine. Is the script the
> problem or is it  SMTP server that I use to send the file?

Are you maybe opening the file on the NT box, and you are forgetting to
use binmode on the filehandle?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | This matter is best disposed of from
Commercial Dynamics Pty. Ltd.   | a great height, over water.
NSW, Australia                  | 


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 5019
**************************************


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