[26106] in Perl-Users-Digest
Perl-Users Digest, Issue: 8303 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 4 06:05:22 2005
Date: Thu, 4 Aug 2005 03:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 4 Aug 2005 Volume: 10 Number: 8303
Today's topics:
Re: "anonymous" variable in Perl? <vtatila@mail.student.oulu.fi>
Re: "anonymous" variable in Perl? <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: "anonymous" variable in Perl? (Anno Siegel)
Graphical User Interface for perl <guenther.sohler@newlogic.com>
Re: Graphical User Interface for perl <kkeller-usenet@wombat.san-francisco.ca.us>
writing binary files <mermadak@yahoo.com>
Re: writing binary files <john@castleamber.com>
Re: writing binary files <mermadak@yahoo.com>
Re: writing binary files <vek@station02.ohout.pharmapartners.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 4 Aug 2005 11:27:58 +0300
From: "Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi>
Subject: Re: "anonymous" variable in Perl?
Message-Id: <dcsjis$o3c$1@news.oulu.fi>
Juha Laiho wrote:
> ... and if more than one of the return values is needed, it's equally
> simple:
> my ($day,$month) = (localtime)[3,4];
Nice, an array slice. Couldn't you also use the range operator to say get
the values two to five with [2 ..5 ]?
One quick question, though. Is there an elegant way of getting the time
components in a hash? It would be easier to memorize if the components had
human-readable names. I think the indeces are mostly arbitrary apart from
going from smaller units to larger which somewhat helps.
--
With kind regards Veli-Pekka Tätilä (vtatila@mail.student.oulu.fi)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/
------------------------------
Date: Thu, 4 Aug 2005 10:45:06 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: "anonymous" variable in Perl?
Message-Id: <Xns96A86D5F9A359elhber1lidotechnet@62.89.127.66>
"Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi> wrote:
> Juha Laiho wrote:
>> ... and if more than one of the return values is needed, it's
>> equally simple:
>> my ($day,$month) = (localtime)[3,4];
> Nice, an array slice. Couldn't you also use the range operator to
> say get the values two to five with [2 ..5 ]?
Short answer: yes.
Long answer: perldoc perldata
> One quick question, though. Is there an elegant way of getting the
> time components in a hash? It would be easier to memorize if the
> components had human-readable names. I think the indeces are
> mostly arbitrary apart from going from smaller units to larger
> which somewhat helps.
my %time;
my @time = qw/day month/;
@time{@time} = (localtime)[3, 4];
Expand as needed.
--
Cheers,
Bernard
------------------------------
Date: 4 Aug 2005 09:04:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: "anonymous" variable in Perl?
Message-Id: <dcslm7$e9g$1@mamenchi.zrz.TU-Berlin.DE>
Veli-Pekka Tätilä <vtatila@mail.student.oulu.fi> wrote in comp.lang.perl.misc:
> Juha Laiho wrote:
> > ... and if more than one of the return values is needed, it's equally
> > simple:
> > my ($day,$month) = (localtime)[3,4];
> Nice, an array slice. Couldn't you also use the range operator to say get
> the values two to five with [2 ..5 ]?
>
> One quick question, though. Is there an elegant way of getting the time
> components in a hash? It would be easier to memorize if the components had
> human-readable names. I think the indeces are mostly arbitrary apart from
> going from smaller units to larger which somewhat helps.
You can do it manually,
my %t;
@t{ qw( sec, min, hour, mday, mon, year, wday, yday, isdst)} = localtime;
my ( $day, $month) = @t{ qw( mday mon)};
but that's probably not what you mean by elegant. The non-standard
module Time::Piece (available from CPAN) does it for you. It overrides
localtime() and gmtime() so that they return objects which support
appropriate methods.
use Time::Piece;
my $t = localtime;
( $day, $month) = ($t->mday, $t->mon);
Note that Time::Piece returns the month (and year) in conventional
counting (from 1) whereas localtime() counts from 0.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Thu, 04 Aug 2005 07:13:01 +0200
From: Guenther Sohler <guenther.sohler@newlogic.com>
Subject: Graphical User Interface for perl
Message-Id: <pan.2005.08.04.05.13.00.916247@newlogic.com>
Hallo,
I'd like to do a perl script which is more user interactive - having
a graphical frontend. I have found perltk,
but its not installed in our company and i dont like the concept of tk.
I more like something like gtk.
Is there an alternative to perl-tk ?
Does any similar language to perl support a graphical interface like gtk ?
rds
------------------------------
Date: Wed, 3 Aug 2005 22:26:36 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Graphical User Interface for perl
Message-Id: <chl8s2xosq.ln2@goaway.wombat.san-francisco.ca.us>
On 2005-08-04, Guenther Sohler <guenther.sohler@newlogic.com> wrote:
>
> I more like something like gtk.
> Is there an alternative to perl-tk ?
Hmm, googling "perl gtk" turns up some interesting results!
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information
------------------------------
Date: Wed, 3 Aug 2005 23:03:28 -0700
From: "mermadak" <mermadak@yahoo.com>
Subject: writing binary files
Message-Id: <QciIe.74014$ro.20842@fed1read02>
I am trying to convert an ANSI encoded ASCII text file to a binary file. I
have looked at the b2a_qp( data[, quotetabs, istext, header]) function at
http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/python/lib/module-binascii.html
but I am not sure if it will do what I need it to or how set it up to take
the data.
Also, the parts of this that really make it an issue is that the data is
coming off of a DOS machine (so endian is a concern here right?) and is a
rather large text file with a ton of scientific data points (from 500k to
5MB files).
Any help would be greatly appreciated.
Thanks,
Dennis Aust
------------------------------
Date: 4 Aug 2005 06:09:20 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: writing binary files
Message-Id: <Xns96A8BA198CF8castleamber@130.133.1.4>
"mermadak" <mermadak@yahoo.com> wrote:
> I am trying to convert an ANSI encoded ASCII text file to a binary
> file. I have looked at the b2a_qp( data[, quotetabs, istext, header])
> function at
> http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/python/lib/modul
> e-binascii.html but I am not sure if it will do what I need it to or
> how set it up to take the data.
Python... hmmm....
> Also, the parts of this that really make it an issue is that the data
> is coming off of a DOS machine (so endian is a concern here right?)
> and is a rather large text file with a ton of scientific data points
> (from 500k to 5MB files).
So basically you want to convert numbers in a text file to some short
binary notation?
5MB... you are aware that the current year is 2005? :-)
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Wed, 3 Aug 2005 23:39:59 -0700
From: "mermadak" <mermadak@yahoo.com>
Subject: Re: writing binary files
Message-Id: <aLiIe.74015$ro.19271@fed1read02>
"John Bokma" <john@castleamber.com> wrote in message
news:Xns96A8BA198CF8castleamber@130.133.1.4...
>> Also, the parts of this that really make it an issue is that the data
>> is coming off of a DOS machine (so endian is a concern here right?)
>> and is a rather large text file with a ton of scientific data points
>> (from 500k to 5MB files).
>
> So basically you want to convert numbers in a text file to some short
> binary notation?
Exactly... any ideas?
> 5MB... you are aware that the current year is 2005? :-)
Does that mean 5MB shouldn't be a problem???
I originally tried writing a program to simply maniplute these files in my
native programming languages of VB and C++ which would hang due to the size
of these files. I finally found a PERL script that would handle parsing this
much data.
Dennis Aust
------------------------------
Date: 04 Aug 2005 06:48:38 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: writing binary files
Message-Id: <slrndf3ei6.2r1.vek@station02.ohout.pharmapartners.nl>
On Wed, 3 Aug 2005 23:39:59 -0700,
mermadak <mermadak@yahoo.com> wrote:
>>
>> So basically you want to convert numbers in a text file to some short
>> binary notation?
>
> Exactly... any ideas?
>
perldoc -f pack.
The pack function can encode all kinds of strange binary formats including
big endian 32bit integers or little endian 16 bit integers. Its cousin
unpack can decode these binary values into normal perl data.
Villy
------------------------------
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 8303
***************************************