[25631] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7873 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 10 00:05:33 2005

Date: Wed, 9 Mar 2005 21:05:18 -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           Wed, 9 Mar 2005     Volume: 10 Number: 7873

Today's topics:
        [ANN] j2Perl 2.0 -- Allowing Java to access Perl code <binhph@gmail.com>
    Re: beta testing <robin@infusedlight.net>
    Re: beta testing <robin@infusedlight.net>
    Re: beta testing <news@chaos-net.de>
    Re: beta testing <pilkowsk@informatik.uni-marburg.de>
    Re: beta testing <1usa@llenroc.ude.invalid>
    Re: cgi question kinda <robin@infusedlight.net>
    Re: conditional <toylet@hotpop.com>
    Re: conditional <spamtrap@dot-app.org>
    Re: converting a line of ascii to decimal (Jay Tilton)
    Re: Documentation for shifting elements of @ARGV <jgibson@mail.arc.nasa.gov>
    Re: Documentation for shifting elements of @ARGV <pilkowsk@informatik.uni-marburg.de>
    Re: Documentation for shifting elements of @ARGV <tadmc@augustmail.com>
    Re: FCNTL in perl <webmaster @ infusedlight.net>
    Re: FCNTL in perl <tadmc@augustmail.com>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <glex_nospam@qwest.invalid>
    Re: HTML::Parser - duplicated text in <h2> .. </h2> ? <jwkenne@attglobal.net>
    Re: multidimensional hash modified by test (Mike Solomon)
    Re: One Liner to reverse sort file <notvalid@email.com>
        perl contribution <robin@infusedlight.net>
    Re: perl contribution <1usa@llenroc.ude.invalid>
    Re: perl contribution (Jay Tilton)
    Re: perl contribution <postmaster@castleamber.com>
        report format and use strict <toylet@hotpop.com>
    Re: report format and use strict <pilkowsk@informatik.uni-marburg.de>
    Re: report format and use strict <shawn.corey@sympatico.ca>
    Re: report format and use strict <toylet@hotpop.com>
    Re: report format and use strict <toylet@hotpop.com>
    Re: string substitution help (search and replace) <sfgroups@gmail.com>
    Re: Using dot commands in a script <robin@infusedlight.net>
    Re: Using dot commands in a script <spamtrap@dot-app.org>
    Re: Using dot commands in a script <jgibson@mail.arc.nasa.gov>
        why <webmaster @ infusedlight.net>
    Re: why <1usa@llenroc.ude.invalid>
    Re: why <postmaster@castleamber.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 9 Mar 2005 19:46:48 -0800
From: "http://vmdd.tech.mylinuxisp.com/catalog/" <binhph@gmail.com>
Subject: [ANN] j2Perl 2.0 -- Allowing Java to access Perl code
Message-Id: <1110426408.853075.130990@o13g2000cwo.googlegroups.com>

Source: http://vmdd.tech.mylinuxisp.co=ADm/catalog/
(Follow "Java Add-ons" link)


j2Perl 2.0 -- provides the ability to use Perl code in Java. This
implementation is elegant and intuitive. Java is already powerful, but
when combined with Perl, Java becomes turbo-charged.


Usage:
        String ret;
        j2Perl pl =3D new j2Perl ("58");        //Load j2perl58.dll which
was linked to
perl58.dll


        ret =3D pl.eval ("mkdir 'h:/aa'");
        ret =3D pl.eval ("mkdir 'h:/aa'; mkdir 'h:/bb';");
        ret =3D pl.eval ("rmdir 'h:/aa'");
        ret =3D pl.eval ("rename 'h:/aa', 'h:/bb'");
        ret =3D pl.eval ("-e 'j2perl.h'");      //Test if the file exists

        ret =3D pl.eval ("-s 't:/a.txt'");      //Returns the file size
in bytes
        ret =3D pl.eval ("-z 'j2perl.h'");      //Test if the file is
empty
        ret =3D pl.eval ("-f 'j2perl.h'");      //Test if the file is a
plain file
        ret =3D pl.eval ("-d 'j2perl.h'");      //Test if the file is a
directory
        ret =3D pl.eval ("-T 't:/a.txt'");      //Test if the file is a
text file
        ret =3D pl.eval ("-B 't:/a.txt'");      //Test if the file is a
binary file
        ret =3D pl.eval ("-M 'h:/jdk-1_5_0-doc.zip'");  //Return age of
the file
(days)
        ret =3D pl.eval ("-A 'h:/jdk-1_5_0-doc.zip'");  //Same for access
time
(days)
        ret =3D pl.eval ("-M 'h:/jdk-1_5_0-doc.zip'");  //Same for inode
change
(days)
        ret =3D pl.eval ("sprintf ('%5d', 12);");       //ret =3D "   12"
        ret =3D pl.eval ("sprintf ('%5.5d', 12);");     //ret =3D "00012"
        ret =3D pl.eval ("sprintf ('this prints 2 decimals: %5.2f',
1=2E23456)");        //ret =3D "this prints 2 decimals:  1.23";
        ret =3D pl.eval ("time;")       //Returns the number of non-leap
seconds since
whatever time the system considers epoch


        ret =3D pl.source ("a.pl");     //Execute a.pl
        ret =3D pl.eval ("unlink 't:/a.txt'");  //Delete the specified
file
        ret =3D pl.eval ("unlink ");    //Delete group of files; Return
number of
files deleted
        ret =3D pl.eval ("$_=3D'this will be translated'; tr/tw/TW/; $_");
      //ret =3D
"This Will be TranslaTed";
        ret =3D pl.eval ("gmtime (time)");      //ret =3D "Wed Mar  2
22:08:34 2005"
        ret =3D pl.eval ("localtime (time)");   //ret =3D "Wed Mar  2
16:12:28 2005"
        ret =3D pl.eval ("hex '0x12'")  //Convert hex to decimal; ret =3D
"18";


        ret =3D pl.eval ("@arr =3D (tien, cam, banh)");
        ret =3D pl.eval ("@result =3D sort @arr");        //ret =3D "3";
        ret =3D pl.eval ("join (' ', @res)");   //ret =3D "banh cam tien";


BE AWARE:
        If perl code has exception, then Java program will exit.  Thus,
make
sure that your perl
        code is extremely robust.


TRIAL:
        Before downloading j2Perl, please note that j2Perl is free for
personal use. But, businesses,
        government agencies, and commercial use require licensing.
Download=20
        now.



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

Date: 9 Mar 2005 15:51:02 -0800
From: "robin" <robin@infusedlight.net>
Subject: Re: beta testing
Message-Id: <1110412262.716548.178960@l41g2000cwc.googlegroups.com>

please do not hack my script. thanks.
-robin



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

Date: 9 Mar 2005 15:53:49 -0800
From: "robin" <robin@infusedlight.net>
Subject: Re: beta testing
Message-Id: <1110412429.090941.122940@z14g2000cwz.googlegroups.com>

more precisely,  where did you get this code?



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

Date: Thu, 10 Mar 2005 01:36:56 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: beta testing
Message-Id: <slrnd2v5l8.8vg.news@maki.homeunix.net>

robin wrote :
> more precisely,  where did you get this code?

other question:
where did you shred your brain?


-- 
perl -e '$|=1;&p(7.74.117.115.116.32);&s();&p(97.110.111);&p(116.104.101
 .114);&s;&p(32.112.101.114.108);&s();&p(32.104.97.99.107.101.114.10);sub
 s{sleep 1};sub p(){print "@_"}'


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

Date: Thu, 10 Mar 2005 01:47:55 +0100
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: beta testing
Message-Id: <MPG.1c99b7a6cf18c2e9898c7@news.individual.de>

* robin wrote:
> 
> more precisely,  where did you get this code?

Eh, everyone could download it. Or why you placed a download link on 
your website?

    http://www.infusedlight.net/

regards,
fabian


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

Date: Thu, 10 Mar 2005 01:37:50 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: beta testing
Message-Id: <Xns9614D1DF52354asu1cornelledu@127.0.0.1>

"robin" <robin@infusedlight.net> wrote in news:1110412262.716548.178960
@l41g2000cwc.googlegroups.com:

> please do not hack my script. thanks.
> -robin

It is not everyday that I meet someone with IQ lower than the room 
temperature.

If you don't want people to see your code (perfectly understandable given 
the way you code), then you should not place a public link to download the 
source code.

If you don't want people to evaluate your code, then you shouldn't ask 
people to test it.

Sinan.


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

Date: 9 Mar 2005 16:12:30 -0800
From: "robin" <robin@infusedlight.net>
Subject: Re: cgi question kinda
Message-Id: <1110413550.363957.302880@l41g2000cwc.googlegroups.com>

fuck that, no one is....
-robin



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

Date: Thu, 10 Mar 2005 10:03:19 +0800
From: man-wai chang <toylet@hotpop.com>
Subject: Re: conditional
Message-Id: <422faae7$1_2@rain.i-cable.com>

> You should always enable warnings when developing Perl code!
> 
> (Especially when perl is doing something you don't understand.

I used `perl -w`. What else do I need?

-- 
  .~.    Might, Courage, Vision. http://www.linux-sxs.org
 / v \
/( _ )\  Linux 2.4.29
  ^ ^    10:02am up 15:16 1 user 1.53 1.30


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

Date: Wed, 09 Mar 2005 21:42:20 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: conditional
Message-Id: <_pydnYsnBviTKbLfRVn-2w@adelphia.com>

man-wai chang wrote:

>> You should always enable warnings when developing Perl code!
>> 
>> (Especially when perl is doing something you don't understand.
> 
> I used `perl -w`. What else do I need?

sherm:~ sherm$ perl -e 'print (($found)? "" : "not")."found\n";'
not

sherm:~ sherm$ perl -w -e 'print (($found)? "" : "not")."found\n";'
print (...) interpreted as function at -e line 1.
Useless use of concatenation (.) or string in void context at -e line 1.
Name "main::found" used only once: possible typo at -e line 1.
not

You need to actually use it. Then, you need to read the warnings it
produces. If you don't understand them, try using diagnostics instead of
warnings, for a longer message:

perl -Mdiagnostics -e 'print (($found)? "" : "not")."found\n";'

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 10 Mar 2005 03:09:37 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: converting a line of ascii to decimal
Message-Id: <422fb83c.190689887@news.erols.com>

"xtrimnx" <xtrimnx@yahoo.com> wrote:

: Okay, so I'm trying to read in the file and take each character one at
: at time and convert them to their numeric equivilants.

    printf '%*vd', ' ', $_;



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

Date: Wed, 09 Mar 2005 18:27:20 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Documentation for shifting elements of @ARGV
Message-Id: <090320051827209113%jgibson@mail.arc.nasa.gov>

In article <ID3vpu.GKo@campus-news-reading.utoronto.ca>, Neil
Montgomery <neil@utstat.toronto.edu> wrote:

> I have solved my actual programming problem, but was frustrated in my 
> attempt to determine the behaviour of @ARGV in the online docs.
> 
> I want to combine data from two files. This combined data will be sorted 
> and modified in various ways which aren't of any importance except that 
> I need to keep track of which file each datum came from.
> 
> I expected the following to do what I needed:
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> 
> my @data;
> while (<>) {

[remainder of program and output snipped]

> 
> I inserted the (commented out) print statement and concluded that the 
> elements of @ARGV are being 'shift'ed, but I wasn't able to find this 
> behaviour documented the online docs (perlvar, perlop, perlsyn, perldoc 
> -q, probably others). I had no success with Google either.
> 
> I fixed the program by saving a copy of @ARGV and using that copy 
> instead. Nevertheless I would like help in finding the documentation for 
> the way @ARGV is handled in this way.

It's in perlop. Search for 'null filehandle'.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Thu, 10 Mar 2005 04:02:30 +0100
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: Documentation for shifting elements of @ARGV
Message-Id: <MPG.1c99d7323c12eb79898c9@news.individual.de>

* Neil Montgomery wrote:
> 
> I have solved my actual programming problem, but was frustrated in my 
> attempt to determine the behaviour of @ARGV in the online docs.
> 
> I want to combine data from two files. This combined data will be sorted 
> and modified in various ways which aren't of any importance except that 
> I need to keep track of which file each datum came from.
> 
> I expected the following to do what I needed:
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> 
> my @data;
> while (<>) {
>      chomp;
> #   print "$ARGV, $ARGV[0]\n";  # For debugging
>      my $file = ($ARGV eq $ARGV[0]) ? "First" : "Second";
>      push @data, [ $file , split(/,/) ];
> }
> 
> foreach (@data) { print "@$_\n" };
> __END__

I think this is a good example to use "eof" without its parenthesis. 
Please study `perldoc -f eof` to learn more about eof's behavior.


    #!/usr/bin/perl -w
    use warnings;
    use strict;

    my @data;
    my $filecnt = 1;

    while ( <> ) {
        chomp;
        push @data, [ $filecnt, split /,/ ];
        $filecnt++ if eof;
    }

    print "@$_\n" for @data;
    __END__


regards,
fabian


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

Date: Wed, 9 Mar 2005 18:40:46 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Documentation for shifting elements of @ARGV
Message-Id: <slrnd2v5se.d9c.tadmc@magna.augustmail.com>

Neil Montgomery <neil@utstat.toronto.edu> wrote:

> I have solved my actual programming problem, but was frustrated in my 
> attempt to determine the behaviour of @ARGV in the online docs.


@ARGV is an array of _data_. 

Data does not _have_ behaviour, code does.

So it must be something else...


> I need to keep track of which file each datum came from.


> while (<>) {


Now we're getting somewhere.

There is an _op_erator that we know makes use of the data in @ARGV.


> and concluded that the 
> elements of @ARGV are being 'shift'ed, but I wasn't able to find this 
               ^^^^            ^^^^^
> behaviour documented the online docs (perlvar, perlop, perlsyn, perldoc 
> -q, probably others).


It ought to be in perlop.pod somewhere, but it took me a while to
find it too. The FAQ calls it the "diamond operator" but perlop
calls it the "null filehandle".

But you had the search terms that led me to find it:

   grep ARGV *.pod | grep shift


See the "I/O Operators" section:

   The null filehandle <> is special
   ...
   It really does shift the @ARGV array


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 9 Mar 2005 17:19:45 -0700
From: "Robin" <webmaster @ infusedlight.net>
Subject: Re: FCNTL in perl
Message-Id: <a8KdnTXpCYzvDLLfRVn-2Q@comcast.com>


"Roach4" <dbelleisle@morphidae.com> wrote in message 
news:46200f9b.0503091143.4de56d6a@posting.google.com...
> Hi,
>
> I'm new to perl and I've to monitor a DIRECTORY for changes in it
> using the FCNTL module in perl.
>
> Anyone could give me a hand by posting examples or hints on how I
> could be able to do that?
>
>
> Thank you very much,
>
> David

please try something simpler like running a chdir ("$yourdir"); command, 
forget those double quotes though.




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

Date: Wed, 9 Mar 2005 21:35:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: FCNTL in perl
Message-Id: <slrnd2vg3i.e1q.tadmc@magna.augustmail.com>

Robin <webmaster@infusedlight.net> wrote:
> "Roach4" <dbelleisle@morphidae.com> wrote in message 
> news:46200f9b.0503091143.4de56d6a@posting.google.com...

>> I'm new to perl and I've to monitor a DIRECTORY for changes in it

> please try something simpler like running a chdir ("$yourdir"); command, 
> forget those double quotes though.


Please consider doing something besides posting to Usenet 
when you are drunk.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 09 Mar 2005 17:11:48 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <UoLXd.49$i37.856@news.uswest.net>

Geoff Cox wrote:
> On Wed, 09 Mar 2005 14:46:43 -0600, "J. Gleixner"
> <glex_nospam@qwest.invalid> wrote:
> 
> 
>>I'm not sure what you're passing to those methods, however simplifying 
>>those to just "tagname", for &start and &end, and "dtext" for &text it 
>>shows what you're seeing if an <h2> occurs within a <p> and/or an <li> 
>>element.
>>
>>Why?? Because $in_p is 1 and $in_h2 is 1, so $txt is printed twice. The 
>>text within 'h2', "abcd" will be displayed 3 times if the html contained 
>><p><ul><h2>abcd</h2></ul></p>.
> 
> 
> Thanks! 
> 
> I checked the HTML and found a <p> associated error which when
> corrected allowed the h2 elements to work correctly. 

Correcting your text method would be a better long-term choice, since
<p><h2>foo</h2></p> is valid HTML, and will occur, not to mention 
<p><ul><li>foo</li></ul></p> or many other nested element combinations. 
  (hint: Do one print, instead of 3, when any of your variables are 1 
and there is text to print.)


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

Date: Wed, 09 Mar 2005 20:44:37 -0500
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: HTML::Parser - duplicated text in <h2> .. </h2> ?
Message-Id: <JKNXd.21106$Ne2.3767@fe11.lga>

J. Gleixner wrote:
> Geoff Cox wrote:
> 
>> On Wed, 09 Mar 2005 14:46:43 -0600, "J. Gleixner"
>> <glex_nospam@qwest.invalid> wrote:
>>
>>
>>> I'm not sure what you're passing to those methods, however 
>>> simplifying those to just "tagname", for &start and &end, and "dtext" 
>>> for &text it shows what you're seeing if an <h2> occurs within a <p> 
>>> and/or an <li> element.
>>>
>>> Why?? Because $in_p is 1 and $in_h2 is 1, so $txt is printed twice. 
>>> The text within 'h2', "abcd" will be displayed 3 times if the html 
>>> contained <p><ul><h2>abcd</h2></ul></p>.
>>
>>
>>
>> Thanks!
>> I checked the HTML and found a <p> associated error which when
>> corrected allowed the h2 elements to work correctly. 
> 
> 
> Correcting your text method would be a better long-term choice, since
> <p><h2>foo</h2></p> is valid HTML,

Actually, no, it isn't. Not in any version.
---
John W. Kennedy
"The bright critics assembled in this volume will doubtless show, in 
their sophisticated and ingenious new ways, that, just as /Pooh/ is 
suffused with humanism, our humanism itself, at this late date, has 
become full of /Pooh./"
   -- Frederick Crews.  "Postmodern Pooh", Preface


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

Date: 9 Mar 2005 15:31:34 -0800
From: mike_solomon@lineone.net (Mike Solomon)
Subject: Re: multidimensional hash modified by test
Message-Id: <56568be5.0503091531.9aa14d@posting.google.com>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message news:<Xns961486B46A5B6asu1cornelledu@132.236.56.8>...
> mike_solomon@lineone.net (Mike Solomon) wrote in 
> news:56568be5.0503090950.13b1f2d6@posting.google.com:
> 
> > I ran the following script and got what I consider to be a strange result
> > 
> > 
> > my %data;
> > 
> > $data{a}{a} = 1;
> > 
> > my $total = keys %data;
> > 
> > print "$total\n";
> > 
> > #prints 1
> > 
> > print "NOT IN HASH\n" unless $data{b}{b};
> 
> This autovivifies $data{b}.
> 
> ...
> 
> > Why does the total keys increase to 2 when I test for non existent data?
> 
> You should use exists if you want to test for existence:
> 
> perldoc -f exists
> 
> Sinan

Thanks everyone

By the way it behaves exactly the same way if you use exists


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

Date: Thu, 10 Mar 2005 00:11:34 GMT
From: Ala Qumsieh <notvalid@email.com>
Subject: Re: One Liner to reverse sort file
Message-Id: <WgMXd.15512$OU1.4864@newssvr21.news.prodigy.com>

hogg wrote:
> I was wondering if there was a one liner that would reverse order a
> file w/o having to write the output to another file. I can reverse
> order a file using: awk '{printf "%10d\t%s\n",NR,$0}' <FILE> | sort -nr
> | cut -f2- >> <FILE2>, but this makes me create another file. I wanted
> to be able to do it 'on the fly'. 
> Any suggestions?

Something like this?

   perl -lp0 -i -e '$_ = join "\n" => reverse split /\n/' in.file

or a bit shorter:

   perl -aF"\n" -lp0 -i -e '$_=join$\,reverse@F' in.file

--Ala


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

Date: 9 Mar 2005 16:06:18 -0800
From: "robin" <robin@infusedlight.net>
Subject: perl contribution
Message-Id: <1110413178.514261.222330@o13g2000cwo.googlegroups.com>

I do have a contrubution it's called:
#!/usr/bin/perl
my $c=0;  my @key;
my $key;
foreach ( sort %ENV)
  {
  $key= join ("=", %ENV);
  @key = split (/=/, $key);
  print "key=$key[$c]\n\n";
  print "value=$key[$c+1]\n\n---";
  ++$c;
  }



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

Date: Thu, 10 Mar 2005 01:33:26 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl contribution
Message-Id: <Xns9614D12064A06asu1cornelledu@127.0.0.1>

"robin" <robin@infusedlight.net> wrote in news:1110413178.514261.222330
@o13g2000cwo.googlegroups.com:

> I do have a contrubution it's called:
> #!/usr/bin/perl
> my $c=0;  my @key;
> my $key;
> foreach ( sort %ENV)
>   {
>   $key= join ("=", %ENV);
>   @key = split (/=/, $key);
>   print "key=$key[$c]\n\n";
>   print "value=$key[$c+1]\n\n---";
>   ++$c;
>   }

What is it supposed to do?

Sinan


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

Date: Thu, 10 Mar 2005 03:24:23 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: perl contribution
Message-Id: <422fba73.191257043@news.erols.com>

"robin" <robin@infusedlight.net> wrote:

: I do have a contrubution

To what are you contributing?

: #!/usr/bin/perl
: my $c=0;  my @key;
: my $key;
: foreach ( sort %ENV)

What on Earth are you doing that for?

:   {
:   $key= join ("=", %ENV);
:   @key = split (/=/, $key);

You can't be serious.

:   print "key=$key[$c]\n\n";
:   print "value=$key[$c+1]\n\n---";
:   ++$c;
:   }

I'm dying here.  On top of adding absurd convolutions to a trivial task,
your program outputs incorrect information.

    print "key=$_\nvalue=$foo{$_}\n\n" for keys %foo;



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

Date: 10 Mar 2005 04:00:58 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: perl contribution
Message-Id: <Xns9614DFF5DC3F2castleamber@130.133.1.4>

Jay Tilton wrote:

> "robin" <robin@infusedlight.net> wrote:
> 
> : I do have a contrubution
> 
> To what are you contributing?
> 
> : #!/usr/bin/perl
> : my $c=0;  my @key;
> : my $key;
> : foreach ( sort %ENV)
> 
> What on Earth are you doing that for?

Greenhouse effect?

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Thu, 10 Mar 2005 10:02:41 +0800
From: man-wai chang <toylet@hotpop.com>
Subject: report format and use strict
Message-Id: <422faac1$1_2@rain.i-cable.com>


format CD_REPORT =

   ^<<<<<<<<<<<<<<<<<  ^<<<<<<<<<<<<<<< $@###.##
$album, $artist, $price
~~^<<<<<<<<<<<<<<<<<  ^<<<<<<<<<<<<<<<
$album, $artist
 .

if I turn on use strict, it will complain about the variable names in 
the format definition. How should I declare the format?

-- 
   .~.    Might, Courage, Vision. http://www.linux-sxs.org
  / v \
/( _ )\  Linux 2.4.29
   ^ ^    10:02am up 15:16 1 user 1.53 1.30


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

Date: Thu, 10 Mar 2005 03:38:51 +0100
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: report format and use strict
Message-Id: <MPG.1c99d1a4258fcb0b9898c8@news.individual.de>

* man-wai chang wrote:
> 
> format CD_REPORT =
> 
>    ^<<<<<<<<<<<<<<<<<  ^<<<<<<<<<<<<<<< $@###.##
> $album, $artist, $price
> ~~^<<<<<<<<<<<<<<<<<  ^<<<<<<<<<<<<<<<
> $album, $artist
> .
> 
> if I turn on use strict, it will complain about the variable names in 
> the format definition. How should I declare the format?

You want to declare those vars with my() before declaring your format to 
use lexical vars:

    my( $album, $artist, $price );

If this results in scoping problems between declaring your format and 
calling write() try out to use the vars pragma like:

    use vars qw( $album $artist $price );

But remember, in that latter case those vars are declared as "global" . 
And using such vars isn't welcome everywhere.

regards,
fabian


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

Date: Wed, 09 Mar 2005 21:30:55 -0500
From: Shawn Corey <shawn.corey@sympatico.ca>
Subject: Re: report format and use strict
Message-Id: <zjOXd.26274$JH1.1183940@news20.bellglobal.com>

man-wai chang wrote:
> 
> format CD_REPORT =
> 
>   ^<<<<<<<<<<<<<<<<<  ^<<<<<<<<<<<<<<< $@###.##
> $album, $artist, $price
> ~~^<<<<<<<<<<<<<<<<<  ^<<<<<<<<<<<<<<<
> $album, $artist
> .
> 
> if I turn on use strict, it will complain about the variable names in 
> the format definition. How should I declare the format?
> 

Declare the variables before the format:

my ( $album, $artist, $price );
format CD_REPORT = ...

BTW, printf is preferred over formats. See:
perldoc -f printf
perldoc Text::Wrap


    --- Shawn


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

Date: Thu, 10 Mar 2005 12:25:36 +0800
From: man-wai chang <toylet@hotpop.com>
Subject: Re: report format and use strict
Message-Id: <422fcc40$1_3@rain.i-cable.com>


> Declare the variables before the format:
> 
> my ( $album, $artist, $price );
> format CD_REPORT = ...
> 

I tried your way, now the errors become:

"my" variable $total masks earlier declaration in same scope at
report.pl line 53.
Use of uninitialized value in formline at report.pl line 11.


-- 
  .~.    Might, Courage, Vision. http://www.linux-sxs.org
 / v \
/( _ )\  Linux 2.4.29
  ^ ^    12:24pm up 17:38 1 user 1.24 1.34


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

Date: Thu, 10 Mar 2005 12:27:12 +0800
From: man-wai chang <toylet@hotpop.com>
Subject: Re: report format and use strict
Message-Id: <422fcca0$1_3@rain.i-cable.com>

man-wai chang wrote:
>> Declare the variables before the format:
>> 
>> my ( $album, $artist, $price );
>> format CD_REPORT = ...
>> 
> 
> I tried your way, now the errors become:
> 
> "my" variable $total masks earlier declaration in same scope at
> report.pl line 53.
> Use of uninitialized value in formline at report.pl line 11.
> 
> 
fixed. I privated the variables twice ith my()

-- 
  .~.    Might, Courage, Vision. http://www.linux-sxs.org
 / v \
/( _ )\  Linux 2.4.29
  ^ ^    12:26pm up 17:40 1 user 1.15 1.29


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

Date: 9 Mar 2005 15:38:25 -0800
From: "Sun" <sfgroups@gmail.com>
Subject: Re: string substitution help (search and replace)
Message-Id: <1110411505.778320.260030@f14g2000cwb.googlegroups.com>

you use use in-place editing option

perl -i.old -npe 's/^(.*thr=3D)\d*(\d\d,.*)$/\1\2=AD/ if 3..4 ; '  a.txt

-SR



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

Date: 9 Mar 2005 16:16:38 -0800
From: "robin" <robin@infusedlight.net>
Subject: Re: Using dot commands in a script
Message-Id: <1110413798.683760.248050@z14g2000cwz.googlegroups.com>

try running in linux, and if that doesn't work, run it in a command
prompt with the perl -M compiler, not that I know how to do that now;
if that still doesn't work, try the exec command or use backtix.
-robin



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

Date: Wed, 09 Mar 2005 21:34:01 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Using dot commands in a script
Message-Id: <RbednT16c8eHL7LfRVn-ug@adelphia.com>

robin wrote:

> try running in linux, and if that doesn't work, run it in a command
> prompt with the perl -M compiler, not that I know how to do that now;
> if that still doesn't work, try the exec command or use backtix.

Good God, where to start...

He *is* running it in *nix, where do you think he's got ksh installed, and
Perl in /usr/local/bin?

The -M switch tells perl to load a module. It's got nothing at all to do
with the Perl compiler.

And last (but certainly not least) his use of system() vs. exec() or
backticks has *nothing* to do with the problem.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Wed, 09 Mar 2005 18:50:39 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Using dot commands in a script
Message-Id: <090320051850393051%jgibson@mail.arc.nasa.gov>

In article <87ekeompx2.fsf@limey.hpcc.uh.edu>, Tony Curtis
<tony_curtis32@yahoo.com> wrote:

> >> On 9 Mar 2005 12:10:55 -0800,
> >> danfperl@yahoo.com said:
>

[problem setting environment variables from perl program snipped]

> 
> Is this a FAQ?  I couldn't find anything obvious with -q.

perldoc -q environment

"I {changed directory, modified my environment} in a perl script.  How
come the change disappeared when I exited the script?  How do I get my
changes to be visible?"


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Wed, 9 Mar 2005 17:15:51 -0700
From: "Robin" <webmaster @ infusedlight.net>
Subject: why
Message-Id: <s6WdnYcVDNUfDbLfRVn-hQ@comcast.com>

would I need to install korean packs when I'm just trying to start a 
discussion.
s

-- 
Robin
--
webmaster@infusedlight.net
-- 




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

Date: Thu, 10 Mar 2005 01:47:05 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: why
Message-Id: <Xns9614D370BEF3Easu1cornelledu@127.0.0.1>

"Robin" <webmaster @ infusedlight.net> wrote in news:s6WdnYcVDNUfDbLfRVn-
hQ@comcast.com:

> would I need to install korean packs when I'm just trying to start a 
> discussion.
> s

Maybe it's a sign.

Sinan


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

Date: 10 Mar 2005 03:13:28 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: why
Message-Id: <Xns9614D7E79408Ecastleamber@130.133.1.4>

Robin wrote:

> would I need to install korean packs when I'm just trying to start a 
> discussion.

Because that's needed to post Perl source code. Also the admin thought it 
was a very nifty way to keep some people out, alas...

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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