[28617] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9981 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 19 11:06:03 2006

Date: Sun, 19 Nov 2006 08:05:15 -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           Sun, 19 Nov 2006     Volume: 10 Number: 9981

Today's topics:
    Re: Date::Parse mysteriously lowercases text when an un <Peter@PSDT.com>
        debugger <robertospara@gmail.com>
    Re: Decompiler anno4000@radom.zrz.tu-berlin.de
    Re: Do I *have* to use 'OOP' to use modules? <merrile@telus.net>
    Re: Do I *have* to use 'OOP' to use modules? <uri@stemsystems.com>
        How to compress a big file into many zip files with Arc <struggle@mail.nankai.edu.cn>
    Re: How to compress a big file into many zip files with <sisyphus1@nomail.afraid.org>
    Re: How to compress a big file into many zip files with anno4000@radom.zrz.tu-berlin.de
    Re: How to compress a big file into many zip files with <m@remove.this.part.rtij.nl>
    Re: How to compress a big file into many zip files with <m@remove.this.part.rtij.nl>
    Re: Module help! <struggle@mail.nankai.edu.cn>
        new CPAN modules on Sun Nov 19 2006 (Randal Schwartz)
    Re: Newbie's easy question/answer - I hope anno4000@radom.zrz.tu-berlin.de
        Returning multiple items from a sub? <robb@acm.org>
    Re: Returning multiple items from a sub? <sisyphus1@nomail.afraid.org>
    Re: Returning multiple items from a sub? <tadmc@augustmail.com>
        Search for a string in a binary file <felad@walla.co.il>
    Re: Search for a string in a binary file <spamtrap@dot-app.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 19 Nov 2006 14:48:39 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: Date::Parse mysteriously lowercases text when an unrelated variable is used.
Message-Id: <pan.2006.11.19.14.48.34.280377@PSDT.com>

On Sun, 19 Nov 2006 12:35:14 +0000, Mumia W. (reading news) wrote:
> To reduce my boredom I took grocery_stocker's data from "At a loss how 
> to sort this file," and I wrote a program to sort it:
> 
>         1 #!/usr/bin/perl
>         2
>         3 use strict;
>         4 use warnings;
>         5 use Date::Parse;
>         6 my $reverser = -1;
>         7
>         8 my $sortfn = sub {
>         9     my ($c, $d) = map str2time(substr($_, 43, 16)), ($a, $b);
>        10     $reverser * ($c <=> $d);
>        11 };
>        12
>        13 @ARGV = 'sort-long-dates.txt';
>        14 my @data = map uc $_, grep /./, <>;
>        15 my @sorted = sort $sortfn @data;
>        16 print join("",@sorted), "\n";
>        17
> 
> The data is sorted as expected, but something strange happens: 
> Date::Parse::str2time lowercases the weekday names. I deliberately 
> capitalize everything on the line to show that only the dates are affected.
[snip]
> BTW, the dates are not modified if the $reverser variable is defined 
> within the $sortfn subroutine, e.g.
> 
>         7 my $sortfn = sub {
>         8     my $reverser = -1;
>         9     my ($c, $d) = map str2time(substr($_, 43, 16)), ($a, $b);
>        10     $reverser * ($c <=> $d);
>        11 };
> 
> What's going on?
> 
> -------------------------------
> Perl 5.8.4
> Debian GNU/Linux 3.1
> Date::Parse 2.27

Good report.  I suspect you are running into the bug reported at
http://groups-beta.google.com/group/perl.perl5.porters/browse_thread/thread/eefb0a6227a31891/7b14af5525b9d861?hl=en
 .  Maybe you could try 5.9.3 on your program and let us know.  If it's not
fixed you can dust off perlbug.

str2time does sort() and lc() internally.  Apparently the bug has
something to do with sort subs that are closures (moving the definition of
$reverser out of the sub does that).

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: 18 Nov 2006 18:40:08 -0800
From: "robertospara" <robertospara@gmail.com>
Subject: debugger
Message-Id: <1163904008.646755.155790@h48g2000cwc.googlegroups.com>

Hi.
I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very  less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.

My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :

    my_regex == son((mother)?father*)+daughter

                                                 |           |  |

                                                13      20   22
So positions 13, 20, 22 I receive from debugger. Then I should write
parser of my regex to get positions  :
 - beginning of sub-regex "(mother)?"
 - beginning of sub-regex "father*"
 - beginning of sub-regex "((mother)?father*)+".

I don't see for now any other way. Any clues nice welcome. Best regards.



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

Date: 19 Nov 2006 02:09:53 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Decompiler
Message-Id: <4s9snhFuf424U1@mid.dfncis.de>

jim <gilbert3b2g@msn.com> wrote in comp.lang.perl.misc:
> Is there such thing as a decompiler that I can use in my window
> enviroment

    use O 'Deparse';

Anno


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

Date: Sun, 19 Nov 2006 03:53:58 GMT
From: Merrilee Larson <merrile@telus.net>
Subject: Re: Do I *have* to use 'OOP' to use modules?
Message-Id: <qzQ7h.17438$C94.12365@edtnps82>

On 2006-11-18, Bart Lateur <bart.lateur@pandora.be> wrote:
> Merrilee Larson wrote:
>
>>Sooo....is it possible to be fully productive using Perl5 in a non-OOP
>>fashion?
>
> Yes.
>
>>Can I still use modules, etc?
>
> Yes. modules can contain any kind of Perl source code.
>
> So of the modules you find on CPAN are written with OO in mind, and if
> there are no alternatives, those will be the ones to use. But you can
> still safely mix OO with procedural code.
>
>>Or would I be severely restricting
>>myself?
>
> Some people think OO is handy for easier managing large projects. If you
> don't feel that way, then you don't have to use it.
>

Thanks for the encouraging post. Perl4 was "my first love", and it seems to me
that Perl's "Golden Years" occured during Perl4's reign. Just my impression,
but I could be wrong. But if I'm correct, it sure says a lot about procedural
Perl. Thanks again. I'm off to look at Tcl/Tk and Scheme/Lisp. Later...
--
duke


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

Date: Sun, 19 Nov 2006 01:41:28 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Do I *have* to use 'OOP' to use modules?
Message-Id: <x74pswrl9j.fsf@mail.sysarch.com>

>>>>> "ML" == Merrilee Larson <merrile@telus.net> writes:

  ML> Thanks for the encouraging post. Perl4 was "my first love", and it
  ML> seems to me that Perl's "Golden Years" occured during Perl4's
  ML> reign. Just my impression, but I could be wrong. But if I'm
  ML> correct, it sure says a lot about procedural Perl. Thanks
  ML> again. I'm off to look at Tcl/Tk and Scheme/Lisp. Later...  --

tcl? lisp? and you dislike perl's OO? you obviously don't know much
about programming languages if you think those are a step up from
perl. and tk isn't a language but a gui toolkit which is available in
perl too.

as for perl4 being its golden years that is absurd. i did a major
project in perl4 that i wish could have been done in perl5 (which wasn't
out yet). i would like to see you try to hack a complex deep data tree
with support for traversals in perl4. please try. if that doesn't
convince you that references alone were worth the change, then you have
no clue about programming in general. i am out of this thread as it is
obvious no one here could convince you the sky is blue.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Sun, 19 Nov 2006 16:15:26 +0800
From: Bo Yang <struggle@mail.nankai.edu.cn>
Subject: How to compress a big file into many zip files with Archive::Zip?
Message-Id: <ejp5u1$b68$1@news.cn99.com>

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

I want to email a big file to in my application.
But the email system will only delivery attachment
with no more than 20M big. So I need compress the
big file into many little zip files, and email
separately.
And I have read the Archive::Zip document, and didn't
find any stuff about that.

Any suggestion will be greatly appreciated !
Thanks in advance!

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFYBKd7tZp58UCwyMRAu0DAJ9mBEwpJT7iNzrP5h489NGfZ/PpmgCeP7at
6Y0RBHcjJxMhHoM+UAv9G/g=
=6lGP
-----END PGP SIGNATURE-----


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

Date: Sun, 19 Nov 2006 20:54:30 +1100
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: How to compress a big file into many zip files with Archive::Zip?
Message-Id: <45602b04$0$21511$afc38c87@news.optusnet.com.au>


"Bo Yang" <struggle@mail.nankai.edu.cn> wrote in message
news:ejp5u1$b68$1@news.cn99.com...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> I want to email a big file to in my application.
> But the email system will only delivery attachment
> with no more than 20M big. So I need compress the
> big file into many little zip files, and email
> separately.

If it comes to the worst, you could arbitrarily split the large file into
(sufficiently) small files, zip them up, and send them off. Then, at the
other end, it's just a matter of unzipping the received files and
concatenating them (in the correct order).

Stay tuned, however, as there may be a smarter way of doing it.

I've actually got a personal interest in this - in that I want to upload a
5.6M file using my ISP's FTP server. But they don't seem to accept anything
bigger than 5M (although they allow me 10M storage). I've thought about
doing exactly as I've advised you, but the additional problem is that, at
their end, they don't give me access to any tool that will do the
concatenation (afaict) .... unless it can be done using "pretty home page"
:-)

Cheers,
Rob




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

Date: 19 Nov 2006 10:05:41 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to compress a big file into many zip files with Archive::Zip?
Message-Id: <4saojlFutiecU1@mid.dfncis.de>

Bo Yang  <struggle@mail.nankai.edu.cn> wrote in comp.lang.perl.misc:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
> 
> I want to email a big file to in my application.
> But the email system will only delivery attachment
> with no more than 20M big. So I need compress the
> big file into many little zip files, and email
> separately.

No.  Email isn't a file transfer program.  Use a file transfer
program to send your file in one piece.

> And I have read the Archive::Zip document, and didn't
> find any stuff about that.

That's because Archive::Zip is about compressing files, not
splitting them.

> Any suggestion will be greatly appreciated !

Use the right tool for the job.

Anno


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

Date: Sun, 19 Nov 2006 11:09:48 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: How to compress a big file into many zip files with Archive::Zip?
Message-Id: <pan.2006.11.19.10.09.48.54759@remove.this.part.rtij.nl>

On Sun, 19 Nov 2006 16:15:26 +0800, Bo Yang wrote:

> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
> 
> I want to email a big file to in my application.
> But the email system will only delivery attachment
> with no more than 20M big. So I need compress the
> big file into many little zip files, and email
> separately.
> And I have read the Archive::Zip document, and didn't
> find any stuff about that.

Correct, that module does not handle multi archive zipfiles. As an
alternative just split the file into smaller files, send those and
concatenate them on the receivers end.

Or send an URL where the other end can get the file using http or ftp.

M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

Date: Sun, 19 Nov 2006 14:57:26 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: How to compress a big file into many zip files with Archive::Zip?
Message-Id: <pan.2006.11.19.13.57.26.754954@remove.this.part.rtij.nl>

On Sun, 19 Nov 2006 10:05:41 +0000, anno4000 wrote:

>> And I have read the Archive::Zip document, and didn't
>> find any stuff about that.
> 
> That's because Archive::Zip is about compressing files, not
> splitting them.

However, zip has options for multivolume archives, Archive::Zip just
doesn't support it. So the expectation is not unreasonable.

M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

Date: Sun, 19 Nov 2006 14:58:40 +0800
From: Bo Yang <struggle@mail.nankai.edu.cn>
Subject: Re: Module help!
Message-Id: <ejp1e2$4iq$1@news.cn99.com>

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

Sherm Pendley :
> Bo Yang <struggle@mail.nankai.edu.cn> writes:
> 
>> Bo Yang :
>>> I have search in cpan and google, but failed.
>>> I want to use PKI in perl, is there any module
>>> for this function?
>>>
>>> Thanks in advance!
>>
>> No body reply to my post, help please!
> 
> It's too vague to give a very useful answer.
> 
> In general, go to <http://search.cpan.org> and search for the specific
> encryption tech you're using - GPG, PGP, SSL, etc.
> 
Oh, thank you, How silly am I!I just search PKI in cpan, Thanks again!

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFYACg7tZp58UCwyMRAomZAJ9LRg6xzVQ1ccXBuj8OE41dnId0TQCfby+0
LAiuP6B7ADE0ucD9kfXRMbQ=
=Iz/V
-----END PGP SIGNATURE-----


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

Date: Sun, 19 Nov 2006 05:42:10 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Nov 19 2006
Message-Id: <J8yqIA.DL0@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

AI-NeuralNet-Simple-0.11
http://search.cpan.org/~ovid/AI-NeuralNet-Simple-0.11/
An easy to use backprop neural net.
----
Attribute-Context-0.042
http://search.cpan.org/~ovid/Attribute-Context-0.042/
Perl extension for automatically altering subroutine behavior based upon context
----
Bundle-BioPerl-2.1.8
http://search.cpan.org/~craffi/Bundle-BioPerl-2.1.8/
A bundle to install external CPAN modules used by BioPerl 1.5.2
----
Catalyst-Plugin-Authentication-Credential-BBAuth-0.02
http://search.cpan.org/~jiro/Catalyst-Plugin-Authentication-Credential-BBAuth-0.02/
Yahoo! Browser-Based Authentication for Catalyst.
----
Device-USB-0.20
http://search.cpan.org/~gwadej/Device-USB-0.20/
Use libusb to access USB devices.
----
Event-Lib-1.01
http://search.cpan.org/~vparseval/Event-Lib-1.01/
Perl extentions for event-based programming
----
HTML2XHTML-0.03.04
http://search.cpan.org/~oembry/HTML2XHTML-0.03.04/
Wrapper to command-line program that converts from HTML 3.x/4.x to XHTML 1.0
----
HTTP-Daemon-App-v0.0.9
http://search.cpan.org/~dmuey/HTTP-Daemon-App-v0.0.9/
Create 2 or 3 line, fully functional (SSL) HTTP server(s)
----
Kwiki-Diff-Mutual-0.01
http://search.cpan.org/~yappo/Kwiki-Diff-Mutual-0.01/
The selection of revision of both parties of Diff is enabled.
----
Log-Dispatch-2.14
http://search.cpan.org/~drolsky/Log-Dispatch-2.14/
Dispatches messages to one or more outputs
----
Mail-GPG-1.0.6
http://search.cpan.org/~jred/Mail-GPG-1.0.6/
Handling of GnuPG encrypted / signed mails
----
Module-Build-Convert-0.44
http://search.cpan.org/~schubiger/Module-Build-Convert-0.44/
Makefile.PL to Build.PL converter
----
Module-Finder-v0.1.2
http://search.cpan.org/~ewilhelm/Module-Finder-v0.1.2/
find and query modules in @INC and/or elsewhere
----
Module-Starter-Plugin-SimpleStore-0.142
http://search.cpan.org/~rjbs/Module-Starter-Plugin-SimpleStore-0.142/
----
Module-Starter-Plugin-TT2-0.123
http://search.cpan.org/~rjbs/Module-Starter-Plugin-TT2-0.123/
TT2 templates for Module::Starter::Template
----
Net-Domain-ExpireDate-0.40
http://search.cpan.org/~despair/Net-Domain-ExpireDate-0.40/
obtain expiration date of domain names
----
Net-Flickr-RDF-1.95
http://search.cpan.org/~ascope/Net-Flickr-RDF-1.95/
a.k.a RDF::Describes::Flickr
----
Net-GPSD-Server-Fake-0.03
http://search.cpan.org/~mrdvt/Net-GPSD-Server-Fake-0.03/
Provides a Fake GPSD test harness.
----
Net-GPSD-Server-Fake-0.04
http://search.cpan.org/~mrdvt/Net-GPSD-Server-Fake-0.04/
Provides a Fake GPSD test harness.
----
Net-Packet-3.22
http://search.cpan.org/~gomor/Net-Packet-3.22/
a framework to easily send and receive frames from layer 2 to layer 7
----
Net-SSL-ExpireDate-1.00
http://search.cpan.org/~hirose/Net-SSL-ExpireDate-1.00/
obtain expiration date of certificate
----
Net-SinFP-2.05
http://search.cpan.org/~gomor/Net-SinFP-2.05/
a full operating system stack fingerprinting suite
----
Net-Whois-Raw-1.20
http://search.cpan.org/~despair/Net-Whois-Raw-1.20/
Get Whois information for domains
----
POE-Component-CPAN-YACSmoke-0.01
http://search.cpan.org/~bingos/POE-Component-CPAN-YACSmoke-0.01/
bringing the power of POE to CPAN smoke testing.
----
PPM-Make-0.91
http://search.cpan.org/~rkobes/PPM-Make-0.91/
Make a ppm package from a CPAN distribution
----
Querylet-Output-Excel-XLS-0.132
http://search.cpan.org/~rjbs/Querylet-Output-Excel-XLS-0.132/
output querylet results to an Excel file
----
String-Sprintf-0.01
http://search.cpan.org/~bartl/String-Sprintf-0.01/
Custom overloading of sprintf
----
Text-Tabs+Wrap-2006.1117
http://search.cpan.org/~muir/Text-Tabs+Wrap-2006.1117/
----
Time-HiRes-Value-0.01
http://search.cpan.org/~pevans/Time-HiRes-Value-0.01/
a class representing a time value or interval in exact microseconds
----
WWW-Form-1.17
http://search.cpan.org/~shlomif/WWW-Form-1.17/
Object-oriented module for HTML form input validation and display
----
XML-LibXML-1.62
http://search.cpan.org/~pajas/XML-LibXML-1.62/
Perl Binding for libxml2
----
XML-LibXSLT-1.62
http://search.cpan.org/~pajas/XML-LibXSLT-1.62/
Interface to the gnome libxslt library


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 19 Nov 2006 02:29:43 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Newbie's easy question/answer - I hope
Message-Id: <4s9tsnFur3lhU1@mid.dfncis.de>

DJ Stunks <DJStunks@gmail.com> wrote in comp.lang.perl.misc:
> David Squire wrote:
> > given that you seem really to be testing for numerical equality
> > here, the version below is probably clearer, and quite possibly faster:
> >
> > ----
> >
> > #!/usr/bin/perl
> >
> > use strict;
> > use warnings;
> >
> > my @good_numbers = (0, 8, 14, 23);
> > for my $i (0..32) {
> > 	$_ == $i and print "Match for $i\n" and last for @good_numbers;
> > }
> >
> > ----
> 
> arrays are not suited for existence tests.

Actually they are if the keys are small integers.

> to truly speedup, use a
> hash.
> 
>   my %good_numbers = map { $_ => 1 } (0, 8, 14, 23);
> 
>   for my $i ( 0..32 ) {
>     print "Match for $i\n" if $good_numbers{$i};
>   }

An existence test in a stricter sense would not even use the
hash values:

    my %good_numbers;@good_numbers{ 0, 8, 14, 23} = ();

    for my $i ( 0..32 ) { 
        print "Match for $i\n" if exists $good_numbers{$i};
    } 

This version translates directly to arrays:

    my @good_numbers;
    @good_numbers[ 0, 8, 14, 23] = ();

    for my $i ( 0..32 ) { 
        print "Match for $i\n" if exists $good_numbers{$i};
    } 


It's a bit unusual to store the good numbers in what looks like
an array of 24 undefs, but the information is all there.  It
wasn't always so, but at some version or other Perl began to
understand exists() for arrays as well as for hashes.

Anno


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

Date: 19 Nov 2006 00:02:15 -0800
From: "robb@acm.org" <robb@acm.org>
Subject: Returning multiple items from a sub?
Message-Id: <1163923335.917563.46330@k70g2000cwa.googlegroups.com>

Hi,

I want to write a sub that returns a list of items so that the syntax
would like this:

my ($thing_one, $thing_two, $thing_three) = MyPackage->my_sub();

Is it possible to write a sub that can be used in this way?  I haven't
figured it out.

Thanks.



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

Date: Sun, 19 Nov 2006 19:13:13 +1100
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Returning multiple items from a sub?
Message-Id: <45601347$0$23136$afc38c87@news.optusnet.com.au>


<robb@acm.org> wrote in message
news:1163923335.917563.46330@k70g2000cwa.googlegroups.com...
> Hi,
>
> I want to write a sub that returns a list of items so that the syntax
> would like this:
>
> my ($thing_one, $thing_two, $thing_three) = MyPackage->my_sub();
>
> Is it possible to write a sub that can be used in this way?  I haven't
> figured it out.
>

package MyPackage;
use warnings;
use strict;

my ($thing_one, $thing_two, $thing_three) = MyPackage->my_sub();

print $thing_one, " ", $thing_two, " ",$thing_three, "\n";

sub my_sub {
    my @ret = (5,7,9);
    return @ret;
}

# or just:
#sub my_sub{ return (6, 8, 10)}

__END__

Cheers,
Rob




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

Date: Sun, 19 Nov 2006 08:08:44 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Returning multiple items from a sub?
Message-Id: <slrnem0pbc.63i.tadmc@tadmc30.august.net>

robb@acm.org <robb@acm.org> wrote:


> I want to write a sub that returns a list of items so that the syntax
> would like this:
>
> my ($thing_one, $thing_two, $thing_three) = MyPackage->my_sub();


So you want it to return a single flat list of scalars.


> Is it possible to write a sub that can be used in this way?  


Errr, yes. All subroutines/methods in Perl return lists (when called in
list context).


> I haven't
> figured it out.


There is no "figuring" needed, there is only "reading the first
couple paragraphs" of perlsub.pod, which is where you go to
learn things related to subroutines in Perl.


   all functions likewise return to their caller one single flat 
   list of scalars.


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


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

Date: 19 Nov 2006 06:25:35 -0800
From: "EF1" <felad@walla.co.il>
Subject: Search for a string in a binary file
Message-Id: <1163946335.501446.229120@h48g2000cwc.googlegroups.com>

Hi

Can someone post an example on how to search a siring in a binary file
?
I spend a lot of time trying to solve it but nothing seems to working



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

Date: Sun, 19 Nov 2006 09:56:41 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Search for a string in a binary file
Message-Id: <m2bqn3v61i.fsf@Sherm-Pendleys-Computer.local>

"EF1" <felad@walla.co.il> writes:

> Can someone post an example on how to search a siring in a binary file

Same way you'd search for it in a multi-line text file. Perl's not C - it
doesn't care about embedded nulls in strings.

> I spend a lot of time trying to solve it but nothing seems to working

Define "not working". What code have you tried? What errors did you get?

Have you read the posting guidelines that appear here frequently?

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

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


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