[30314] in Perl-Users-Digest
Perl-Users Digest, Issue: 1557 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 19 18:09:51 2008
Date: Mon, 19 May 2008 15:09:09 -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 Mon, 19 May 2008 Volume: 11 Number: 1557
Today's topics:
Accessing individual bits in a number <pinaki_m77@yahoo.com>
Re: Accessing individual bits in a number sln@netherlands.co
Re: Accessing individual bits in a number <smallpond@juno.com>
Re: Assigning virtual filename to eval block <1usa@llenroc.ude.invalid>
Extracting links from a html table David.Bramer@googlemail.com
Re: Extracting links from a html table <bill@ts1000.us>
help perl & artnet (dmx) example / library? <swest@gmx.de>
Re: I need ideas on how to sort 350 million lines of da <tzz@lifelogs.com>
Perl software? <amerar@iwc.net>
Re: Perl software? xhoster@gmail.com
Re: Perl software? <glex_no-spam@qwest-spam-no.invalid>
Re: Perl to C++ <eg0@m0ulinette.0rg>
Re: Perl to C++ sln@netherlands.co
Re: Perl to C++ sln@netherlands.co
Re: Problems with GetOpt <dirk.heinrichs@online.de>
Re: Problems with GetOpt <ben@morrow.me.uk>
Re: script to find the files with very long names (David Combs)
Re: Strawberry <rahim.g.fakir@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 May 2008 13:07:21 -0700 (PDT)
From: googler <pinaki_m77@yahoo.com>
Subject: Accessing individual bits in a number
Message-Id: <fba8a37c-7bb5-4513-bcee-b13fce7b4e62@w4g2000prd.googlegroups.com>
I need to find the Gray code equivalent of a given number. The number
should be entered as an input (in decimal) and the output should be
the Gray code equivalent (a string of 1s and 0s). For this
computation, I need to perform XOR operations between the bits of the
input number. Is there a way by which individual bits in a number can
be accessed in Perl? I did it in the following way (assuming each
number is 16 bits wide).
--------
$input_decimal = <STDIN>;
##calculate binary
$x = $input_decimal;
for ($i = 0; $i < 16; $i++)
{
$binary[$i] = $x & 0x0001;
$x = $x >> 1;
}
print "binary: ";
print reverse(@binary);
##calculate gray
$gray[15] = $binary[15];
for ($i = 14; $i >= 0; $i--)
{
$gray[$i] = $binary[$i+1] ^ $binary[$i];
}
print "\ngray: ";
print reverse(@gray);
print "\n";
--------
Basically I extracted each bit from the input number and placed them
in an array (called @binary) and peformed XOR operations on these
array elements. It works, but I guess there might be a better way to
do it. Please comment. Thanks.
------------------------------
Date: Mon, 19 May 2008 13:42:23 -0700
From: sln@netherlands.co
Subject: Re: Accessing individual bits in a number
Message-Id: <qto334dt1envilgajkviousfpafn3ood7j@4ax.com>
On Mon, 19 May 2008 13:07:21 -0700 (PDT), googler <pinaki_m77@yahoo.com> wrote:
>I need to find the Gray code equivalent of a given number. The number
>should be entered as an input (in decimal) and the output should be
>the Gray code equivalent (a string of 1s and 0s). For this
>computation, I need to perform XOR operations between the bits of the
>input number. Is there a way by which individual bits in a number can
>be accessed in Perl? I did it in the following way (assuming each
>number is 16 bits wide).
>
>--------
>
>$input_decimal = <STDIN>;
>
>##calculate binary
>$x = $input_decimal;
>for ($i = 0; $i < 16; $i++)
>{
> $binary[$i] = $x & 0x0001;
this looks like 1 or 0
> $x = $x >> 1;
$binary array will propagate alternate 0/1 where
$binary[0] depends on if input decimal is even or odd
>}
>
>print "binary: ";
>print reverse(@binary);
>
>##calculate gray
>$gray[15] = $binary[15];
this looks like a single element asignment
-<snip>-
------------------------------
Date: Mon, 19 May 2008 17:19:32 -0400
From: smallpond <smallpond@juno.com>
Subject: Re: Accessing individual bits in a number
Message-Id: <bc9f2$4831eeee$17008@news.teranews.com>
googler wrote:
> I need to find the Gray code equivalent of a given number. The number
> should be entered as an input (in decimal) and the output should be
> the Gray code equivalent (a string of 1s and 0s). For this
> computation, I need to perform XOR operations between the bits of the
> input number. Is there a way by which individual bits in a number can
> be accessed in Perl? I did it in the following way (assuming each
> number is 16 bits wide).
>
> --------
>
> $input_decimal = <STDIN>;
>
> ##calculate binary
> $x = $input_decimal;
> for ($i = 0; $i < 16; $i++)
> {
> $binary[$i] = $x & 0x0001;
> $x = $x >> 1;
> }
>
This gives your array without the loop:
$bstring = sprintf "%016b",$input_decimal;
@binary = split //,reverse($bstring);
The rest looks pretty efficient.
** Posted from http://www.teranews.com **
------------------------------
Date: Mon, 19 May 2008 13:09:49 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Assigning virtual filename to eval block
Message-Id: <Xns9AA35D379BFEEasu1cornelledu@127.0.0.1>
tobias.grimm@cas-soft.de wrote in news:3f7209a1-8a50-4c4d-84e0-
e8266c2f8315@k13g2000hse.googlegroups.com:
> this was just as small sample. I have a perl module written in C++
> which generates perl module code at runtime and evals it, so it
> becomes available to the calling perl application.
Well, thank you for the explanation. You know, I really did not think
"print 1/0" was the actual code you were eval'ing ;-)
Apologies for the misunderstanding.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Mon, 19 May 2008 13:48:51 -0700 (PDT)
From: David.Bramer@googlemail.com
Subject: Extracting links from a html table
Message-Id: <f55ed703-7567-4875-9c73-ee2beb70ba8a@f36g2000hsa.googlegroups.com>
Hi
Thought I would share my code with you as it might help to fix my
problem a bit quicker...
I thought I would be able to some how use table extract to pull out
the links to each of the fund names at the URL in the variable
$MORNINGSTAR.
For instance "CAAM Funds Latin America Equities C Inc" has a link
http://www.morningstar.co.uk/UK/snapshot/snapshot.aspx?id=F0GBR05SXI
This is what I would like to extract.
Does anyone know how I can do this with Tableextract or Mechanize?
Your help would be really appreciated!
Thanks
David
#!/usr/local/bin/perl
use HTML::TableExtract;
use LWP::Simple;
use WWW::Mechanize;
## Morningstar launch page
$MORNINGSTAR="http://www.morningstar.co.uk/UK/ISAQuickrank/
default.aspx?tab=1&sortby=ReturnM60&lang=en-GB";
$NASDAQ_PRICE_DATA="nasdaq_daily.txt";
## Variables
my @nasdaqPrices; ## array containing nasdaq close prices
my $mech = WWW::Mechanize->new(); ## perl agent
my $content; ## webpage content
my $link_name;
my $nasdaqWeekly; ## Weekly nasdaq change
my $nasdaqDaily; ## Daily nasdaq change
## Obtain latest NASDAQ values
@nasdaqPrices = &nasdaqToArray($NASDAQ_PRICE_DATA);
$nasdaqWeekly = &nasdaqPerformanceWeekly(@nasdaqPrices);
print "Nasdaq w ".$nasdaqWeekly."\n";
$nasdaqDaily = &nasdaqPerformanceDaily(@nasdaqPrices);
print "Nasdaq d ".$nasdaqDaily."\n";
#print scalar(@nasdaqPrices)."\n";
#print "@nasdaqPrices";
##exit;
$mech->agent_alias("Windows IE 6");
$mech->get($MORNINGSTAR);
#$content = get($MORNINGSTAR);
## Find the total number of pages
$link_name = $mech->find_link( text => "last" );
$re='.*?'.'[-+]?\\d+'.'.*?'.'[-+]?\\d+'.'.*?'.'[-+]?\\d+'.'.*?'.'[-+]?
\\d+'.'.*?'.'([-+]?\\d+)';
if ($link_name->url() =~ m/$re/is)
{
$total_pages=$1;
}
## Print ever single page out.
for ($count=1;$count<=$total_pages;$count++)
{
## if first go then print the
if ($count == 1)
{
##&printTable($content, $nasdaqDaily, $nasdaqWeekly);
&printTable($mech, $nasdaqDaily, $nasdaqWeekly);
}
else
{
#&doPostBack($mech, 'ctl00$ctl00$MainContent$Layout_1MainContent
$AspNetPager1',$count);
#&printTable($mech->content(), $nasdaqDaily, $nasdaqWeekly);
&doPostBack($mech, 'ctl00$ctl00$MainContent$Layout_1MainContent
$AspNetPager1',$count);
&printTable($mech, $nasdaqDaily, $nasdaqWeekly);
}
}
sub printTable()
{
my $contents = shift;
my $dailychange = shift;
my $weeklychange = shift;
my $link;
my $webpage = $contents->content();
## Print out a table of values
my $te = HTML::TableExtract->new( headers => [
##qw(Fund\sName Risk Std\sDev YTD 1\sYr 3\sYr\nAnlsd 5\sYr
10\sYr)
qw(Fund\sName Latest\nPrice 1\sDay 1\sWeek 1\sMonth 3\sMonth
6\sMonth Date)
], );
$te->parse($webpage);
##$te->parse($content(
foreach $ts ($te->tables)
{
foreach ($ts->rows)
{
($fund_name, $latest_price, $p1_day, $p1_week, $p1_month,
$p3_month, $p6_month, $pdate) = @$_;
if (($p1_day > $dailychange) && ($p1_day > 0))
{
print $fund_name."\t\t\t\t\t\t\t".$p1_day."\t".$dailychange."\n";
## find the link
$link = $contents->find_link( text => $fund_name );
##print $link."\n\n";
}
}
}
}
sub doPostBack()
{
my $agent = shift; ## WWW::Mechanize agent-object
my $target = shift; ## first argument in the __doPostBack() call
my $arg = shift;
$agent->form_name("aspnetForm");
$agent->field('__EVENTTARGET', $target);
$agent->field('__EVENTARGUMENT', $arg);
$agent->submit();
}
sub nasdaqToArray()
{
my @nasdaqPriceList;
my $nasdaq_price_data = shift;
open (NASDAQ, "$nasdaq_price_data") || die "File not found\n";
while ($line =<NASDAQ>)
{
chomp $line; # removes the carriage return
push @nasdaqPriceList, split(/, / , $line); # breaks the line up
into fields
}
close NASDAQ;
return @nasdaqPriceList;
}
sub nasdaqPerformanceDaily()
{
my @nasdaqPriceList = @_;
my $nasdaqDailyPC;
my $old = @nasdaqPriceList[-2];
my $new = @nasdaqPriceList[-1];
$nasdaqDailyPC = sprintf("%.4f", ((($new - $old) / $old) * 100));
return $nasdaqDailyPC;
}
sub nasdaqPerformanceWeekly()
{
my @nasdaqPriceList = @_;
my $nasdaqWeeklyPC;
my $old = @nasdaqPriceList[-5];
my $new = @nasdaqPriceList[-1];
$nasdaqWeeklyPC = sprintf("%.4f", ((($new - $old) / $old) * 100));
return $nasdaqWeeklyPC;
}
------------------------------
Date: Mon, 19 May 2008 14:40:47 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: Extracting links from a html table
Message-Id: <1ad7a209-caca-4c8d-b7fc-2294f8162297@r66g2000hsg.googlegroups.com>
On May 19, 4:48=A0pm, David.Bra...@googlemail.com wrote:
> Hi
>
> Thought I would share my code with you as it might help to fix my
> problem a bit quicker...
>
> I thought I would be able to some how use table extract to pull out
> the links to each of the fund names at the URL in the variable
> $MORNINGSTAR.
>
> For instance "CAAM Funds Latin America Equities C Inc" has a linkhttp://ww=
w.morningstar.co.uk/UK/snapshot/snapshot.aspx?id=3DF0GBR05SXI
> This is what I would like to extract.
>
> Does anyone know how I can do this with Tableextract or Mechanize?
>
> Your help would be really appreciated!
>
> Thanks
>
> David
>
[snip]
David
It looks like the link you gave is an example of one of the links you
want to extract. Looking at a few of their other pages it seems thay
all have the same url in common and the only thing that changes is the
id. Looking at the source for one of the pages all the various links
have the format:
href=3D"/UK/snapshot/snapshot.aspx?id=3D????????"
where ???? is the id number I think you are looking for. I would go
through the source looking for text that started with href=3D"/UK/
snapshot/snapshot.aspx?id=3D and then extract the id number into an
array.
I hope I am making sense.
Bill H
------------------------------
Date: Mon, 19 May 2008 17:02:27 +0200
From: Susanne West <swest@gmx.de>
Subject: help perl & artnet (dmx) example / library?
Message-Id: <d5b5e$4831967f$544b8434$25277@news.hispeed.ch>
i'm desperately seeking for an example or even a
library that deals with the communication from
perl out to a artnet (dmx) device...
anyone? thanks a ton!
------------------------------
Date: Mon, 19 May 2008 12:00:15 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: I need ideas on how to sort 350 million lines of data
Message-Id: <86wslqp6u8.fsf@lifelogs.com>
On Sat, 17 May 2008 08:21:21 -0700 (PDT) chadda@lonemerchant.com wrote:
c> I have roughly 350 million lines of data in the following form
c> name, price, weight, brand, sku, upc, size
c> sitting on my home PC.
c> Is there some kind of sane way to sort this without taking up too much
c> ram or jacking up my limited CPU time?
One simple way, without using databases, is to take smaller pieces (say,
10K lines each) and sort them individually by whatever field you need.
Then you take the top or bottom of each piece, make a new set, and sort
that set for the final result.
If you need to sort the whole list and not just get the max/min, apply
the same algorithm except you keep each sorted piece open and keep
taking the smallest/largest element from the top/bottom of the piece
that contains it.
For more information and if my explanation doesn't make sense, look up
the "merge sort" algorithm.
Ted
------------------------------
Date: Mon, 19 May 2008 13:40:35 -0700 (PDT)
From: "amerar@iwc.net" <amerar@iwc.net>
Subject: Perl software?
Message-Id: <814e31c2-3030-4b78-a3a9-7194f8483a68@m3g2000hsc.googlegroups.com>
Hi,
we have some data in a MySQL database. We're looking for a way to
somehow query that data and present it in a line graph which will be
emailed to the users......I'm assuming that the document will be an
HTML document.
Are there utilities or Perl modules for this? We're running Linux
(Cent-OS).
Thank you......
------------------------------
Date: 19 May 2008 20:58:29 GMT
From: xhoster@gmail.com
Subject: Re: Perl software?
Message-Id: <20080519165831.509$gS@newsreader.com>
"amerar@iwc.net" <amerar@iwc.net> wrote:
> Hi,
>
> we have some data in a MySQL database. We're looking for a way to
> somehow query that data
DBI and DBD::mysql
> and present it in a line graph
GD::Graph, or Image::Magick, or Chart::Graph::Gnuplot, etc.
You might be able to use DBIx::Chart to combine both the selecting
and the graphing in fell swoop. Never used it myself, and I tend to
prefer focussed tools rather than one thing to do everything.
> which will be
> emailed to the users......I'm assuming that the document will be an
> HTML document.
For the simple type of mail I do, I just open a pipe to the mail program,
but there are all kinds of modules that can help with more complicated
stuff. HTML usually refers one to a URL to get the image, so if you need
the image itself to be embedded in the mail, you probably need MIME or
something more complicated than just plain HTML.
perldoc -q mail
How do I use MIME to make an attachment to a mail message?
This suggests MIME::Lite
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Mon, 19 May 2008 16:40:52 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Perl software?
Message-Id: <4831f3e4$0$48217$815e3792@news.qwest.net>
xhoster@gmail.com wrote:
> "amerar@iwc.net" <amerar@iwc.net> wrote:
>> Hi,
>>
>> we have some data in a MySQL database. We're looking for a way to
>> somehow query that data
>
> DBI and DBD::mysql
>
>> and present it in a line graph
>
> GD::Graph, or Image::Magick, or Chart::Graph::Gnuplot, etc.
>
> You might be able to use DBIx::Chart to combine both the selecting
> and the graphing in fell swoop. Never used it myself, and I tend to
> prefer focussed tools rather than one thing to do everything.
>
>
>> which will be
>> emailed to the users......I'm assuming that the document will be an
>> HTML document.
>
> For the simple type of mail I do, I just open a pipe to the mail program,
> but there are all kinds of modules that can help with more complicated
> stuff. HTML usually refers one to a URL to get the image, so if you need
> the image itself to be embedded in the mail, you probably need MIME or
> something more complicated than just plain HTML.
>
> perldoc -q mail
> How do I use MIME to make an attachment to a mail message?
>
> This suggests MIME::Lite
Very good answer. I'd just like to add that to get and install
these modules, you might want to read about using CPAN:
perldoc -q cpan
------------------------------
Date: Mon, 19 May 2008 16:12:30 +0200
From: Ego <eg0@m0ulinette.0rg>
Subject: Re: Perl to C++
Message-Id: <48318acd$0$25773$426a74cc@news.free.fr>
miztaken wrote:
> Hi there,
> I dont know how to perl.
> Can anybody convert this code (sub routine) from perl to C++.
> I would be very much grateful
>
> [bunch of perl code]
>
www.rentacoder.com
regards, Michael
--
Michael K. [meik@moulinette.org]
http://moulinette.org/~meik/
------------------------------
Date: Mon, 19 May 2008 09:53:25 -0700
From: sln@netherlands.co
Subject: Re: Perl to C++
Message-Id: <gpb3345f3ujtlst4273taq42dkr7mvt7iu@4ax.com>
On Sat, 17 May 2008 23:43:03 -0700 (PDT), miztaken <justjunktome@gmail.com> wrote:
>Hi there,
>I dont know how to perl.
>Can anybody convert this code (sub routine) from perl to C++.
>I would be very much grateful
>
>sub OleUnpackPackages {
> my($this, $explodeinto, $parentname, @NativeFilenames) = @_;
>
> my($infh, $byte, $number, $buffer, $outname);
> my($finished);
>
> OLEFILE: foreach my $inname (@NativeFilenames) {
> $byte = "";
> $buffer = "";
> close $infh if $infh;
> $infh = new FileHandle;
> sysopen $infh, "$explodeinto/$inname", O_RDONLY; sysseek $infh,
>6, SEEK_SET; # Skip 1st 6 bytes
> $outname = "";
> $finished = 0;
> until ($byte eq "\0" || $finished) { # Read a C-string into
>$outname
> sysread($infh, $byte, 1) or $finished = 1;
> $outname .= $byte;
> }
># Then there is a null-terminated ASCII string which is the filename
>of the object.
> #print STDERR "Output filename is $outname\n";
> $finished = 0;
> $byte = 1;
> until ($byte eq "\0" || $finished) { # Throw away a C-string
> sysread($infh, $byte, 1) or $finished = 1;
> }
># Throw away the next null-terminated ASCII string
> sysseek $infh, 4, Fcntl::SEEK_CUR or next OLEFILE; # Skip next 4
>bytes
># Throw away next 4 byte int
> sysread $infh, $number, 4 or next OLEFILE;
> $number = unpack 'V', $number;
># The next 4 bytes are an int giving the length of the next bit of the
>header
> #print STDERR "Skipping $number bytes of header filename\n";
> sysseek $infh, $number, Fcntl::SEEK_CUR; # Skip the next bit of
>header (C-string)
># Skip over the next bit of the header whose length we just read
> sysread $infh, $number, 4 or next OLEFILE;
> $number = unpack 'V', $number;
> #print STDERR "Reading $number bytes of file data\n";
># Then you have a 4-byte int which is the length of the real embedded
>original file
> sysread $infh, $buffer, $number
> if $number < -s "$explodeinto/$inname"; # Sanity check
># Read in all the data of the original embedded file
> my $outfh = new FileHandle;
> my $outsafe = $this->MakeNameSafe($outname, $explodeinto);
> sysopen $outfh, "$explodeinto/$outsafe", (O_CREAT | O_WRONLY)
> or next OLEFILE;
> syswrite $outfh, $buffer, $number or next OLEFILE;
> close $outfh;
> # Set up MailScanner data structures
> $this->{file2parent}{$outname} = $parentname;
> $this->{file2parent}{$outsafe} = $parentname;
> $this->{file2safefile}{$outname} = $outsafe;
> $this->{safefile2file}{$outsafe} = $outname;
>
> }
> close $infh if $infh;
>}
>
>Please help me
>miztaken
If you know C++, this should get you started. Otherwise my 5 minutes was wasted.
######################################################################################
sub OleUnpackPackages
{
my($this, $explodeinto, $parentname, @NativeFilenames) = @_;
my($infh, $byte, $number, $buffer, $outname);
my($finished);
OLEFILE:
foreach my $inname (@NativeFilenames)
{
$byte = "";
$buffer = "";
close $infh if $infh;
$infh = new FileHandle;
sysopen $infh, "$explodeinto/$inname", O_RDONLY;
Loop until all files are processed......
open infile, read in HdrOffset, any errors, close infile, continue on with next file
-------------------------------------------------------------------------------------
typedef unsigned char BYTE;
#pragma pack(push,1)
struct HdrOffset
{
# Skip 1st 6 bytes
sysseek $infh, 6, SEEK_SET;
$outname = "";
$finished = 0;
BYTE skip1[6];
# Read a C-string into $outname
until ($byte eq "\0" || $finished)
{
sysread($infh, $byte, 1) or $finished = 1;
$outname .= $byte;
}
CString strOutfile; (from ATL template class)
# Then there is a null-terminated ASCII string which is the filename
# of the object.
#print STDERR "Output filename is $outname\n";
$finished = 0;
$byte = 1;
until ($byte eq "\0" || $finished)
{
# Throw away a C-string
sysread($infh, $byte, 1) or $finished = 1;
}
??? # Throw away the next null-terminated ASCII string
sysseek $infh, 4, Fcntl::SEEK_CUR or next OLEFILE; # Skip next 4 bytes
BYTE skip2[4];
# Throw away next 4 byte int
sysread $infh, $number, 4 or next OLEFILE;
int number;
};
#pragma pack(pop)
$number = unpack 'V', $number;
# The next 4 bytes are an int giving the length of the next bit of the header
#print STDERR "Skipping $number bytes of header filename\n";
sysseek $infh, $number, Fcntl::SEEK_CUR; # Skip the next bit of header (C-string)
seek infile to HdrOffset::number, read in length
----------------------------------------------
# Skip over the next bit of the header whose length we just read
sysread $infh, $number, 4 or next OLEFILE;
int length;
$number = unpack 'V', $number;
#print STDERR "Reading $number bytes of file data\n";
read next BYTE[length] into buffer
-----------------------------------
# Then you have a 4-byte int which is the length of the real embedded original file
sysread $infh, $buffer, $number
byte *buffer = new BYTE[length];
close infile, open outfile
write buffer to outfile
close outfile
delete buffer;
if $number < -s "$explodeinto/$inname"; # Sanity check
# Read in all the data of the original embedded file
my $outfh = new FileHandle;
my $outsafe = $this->MakeNameSafe($outname, $explodeinto);
sysopen $outfh, "$explodeinto/$outsafe", (O_CREAT | O_WRONLY) or next OLEFILE;
syswrite $outfh, $buffer, $number or next OLEFILE;
close $outfh;
# Set up MailScanner data structures
$this->{file2parent}{$outname} = $parentname;
$this->{file2parent}{$outsafe} = $parentname;
$this->{file2safefile}{$outname} = $outsafe;
$this->{safefile2file}{$outsafe} = $outname;
}
close $infh if $infh;
}
------------------------------
Date: Mon, 19 May 2008 10:08:28 -0700
From: sln@netherlands.co
Subject: Re: Perl to C++
Message-Id: <mrc33454dsm39qslm49affr0pk15724tn0@4ax.com>
On Mon, 19 May 2008 09:53:25 -0700, sln@netherlands.co wrote:
>On Sat, 17 May 2008 23:43:03 -0700 (PDT), miztaken <justjunktome@gmail.com> wrote:
>
--snip--
>read next BYTE[length] into buffer
>-----------------------------------
> # Then you have a 4-byte int which is the length of the real embedded original file
> sysread $infh, $buffer, $number
>
>byte *buffer = new BYTE[length];
^
BYTE *pBuffer = new BYTE[length];
>
>
>close infile, open outfile
>write buffer to outfile
>close outfile
>delete buffer;
^
if (pBuffer)
delete pBuffer;
------------------------------
Date: Mon, 19 May 2008 18:25:52 +0200
From: Dirk Heinrichs <dirk.heinrichs@online.de>
Subject: Re: Problems with GetOpt
Message-Id: <g0s9mg$tf8$1@online.de>
Paul Richardson wrote:
>> And what do you get?
> I got n nothing as in , nothing was printed out , I expected to see
> "someRandomFileName" printed out
Add the \n to the second print, like
print $someRandomFileName . "\n";
and replace "die" with "exit (0)". Should work, then.
Bye...
Dirk
------------------------------
Date: Mon, 19 May 2008 19:11:52 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Problems with GetOpt
Message-Id: <8gs8g5-7161.ln1@osiris.mauzo.dyndns.org>
Quoth Dirk Heinrichs <dirk.heinrichs@online.de>:
> Paul Richardson wrote:
>
> >> And what do you get?
> > I got n nothing as in , nothing was printed out , I expected to see
> > "someRandomFileName" printed out
>
> Add the \n to the second print, like
>
> print $someRandomFileName . "\n";
print "$someRandomFileName\n";
or
local $\ = "\n";
print $someRandomFileName;
or
use 5.010;
say $someRandomFileName;
> and replace "die" with "exit (0)". Should work, then.
s/and/or/;
Or just fall off the end, as is usual with Perl programs.
Ben
--
And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
* ben@morrow.me.uk *
------------------------------
Date: Mon, 19 May 2008 22:01:34 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: script to find the files with very long names
Message-Id: <g0stbu$dvf$1@reader2.panix.com>
In article <4812C50A.2010409@lsupcaemnt.com>,
Ed Morton <morton@lsupcaemnt.com> wrote:
>On 6/12/2006 2:34 AM, pui ming Wong wrote:
>> My objective is to go down the current directory
>> and have the system tells me which files have their names
>> longer than say 26 characters
>>
>> i think mixing the unix find command
>> with some other commands might do it.
>> But a perl script might do it more tidily and faster ?
>
>find . -name "??????????????????????????*"
>
>That's 26 question marks, or if you prefer to specify a value:
>
>find . -name "$(printf "%26s*"|tr ' ' '?')"
>
>Regards,
>
> Ed.
>
If 26 is what you *really* want to do, isn't there nowadays
a \{26\} suffix that will do it? (At least that's what
works in emacs.)
David
------------------------------
Date: Mon, 19 May 2008 13:24:07 -0700 (PDT)
From: sanozuke <rahim.g.fakir@gmail.com>
Subject: Re: Strawberry
Message-Id: <374a1975-1d63-43c7-9604-62b3997c9133@k13g2000hse.googlegroups.com>
I put in the command line perl hello.pl and perl perl40.pl and a pop
up very quicly appear's, just show up and don't gives time to see
anything.
What is that is going wrong
------------------------------
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 V11 Issue 1557
***************************************