[28662] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 10026 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 1 14:05:46 2006

Date: Fri, 1 Dec 2006 11:05:08 -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           Fri, 1 Dec 2006     Volume: 10 Number: 10026

Today's topics:
    Re: Add a #include line to all c/c++ plus files <m@remove.this.part.rtij.nl>
        Base64 MIME <bigus@abdcdefghijk.com>
    Re: CPAN modules in commercial programs <benmorrow@tiscali.co.uk>
    Re: Date function <Holleran.Kevin@gmail.com>
    Re: Date function <glex_no-spam@qwest-spam-no.invalid>
    Re: Date function <spamtrap@dot-app.org>
    Re: exec dynamic script, capture output, but see vars o xhoster@gmail.com
    Re: How can I change color font in GTK2? <zentara@highstream.net>
    Re: how to do this with RE? <scobloke2@infotop.co.uk>
    Re: how to do this with RE? <rvtol+news@isolution.nl>
    Re: I need to read web pages without LWP <zentara@highstream.net>
    Re: Regex failed to replace utf8 character anno4000@radom.zrz.tu-berlin.de
    Re: Regex failed to replace utf8 character <mccownf@yahoo.com>
        RegEx variable isolation <colin@yoursupport.biz>
    Re: RegEx variable isolation <wahab-mail@gmx.de>
    Re: RegEx variable isolation <colin@yoursupport.biz>
        unable to use @ARG in Perl ragavendran31@gmail.com
    Re: unable to use @ARG in Perl <1usa@llenroc.ude.invalid>
    Re: unable to use @ARG in Perl <jurgenex@hotmail.com>
    Re: unable to use @ARG in Perl <jgibson@mail.arc.nasa.gov>
    Re: using DateTime object <rvtol+news@isolution.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 01 Dec 2006 18:59:03 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: Add a #include line to all c/c++ plus files
Message-Id: <pan.2006.12.01.17.59.03.4429@remove.this.part.rtij.nl>

On Thu, 30 Nov 2006 22:42:47 -0800, RedDevilDan wrote:

> I am new to Perl.  In linux/unix, is there anyway to add the #include
> line to all *.c or *.cpp files automatically?
> 
> I have a large project which contains thousands of .c or .cpp source
> files.  However, I decided to #include a common header file into all
> source files in order to config them globally.  Is there anyway to do
> that easily?

Probably. Something along the lines of (greatly untested)

$ find . -name "*.c" -o -name "*.cpp" | while read f ; do
> perl -p -i'.bak' -e 'BEGIN { print "include <myheader.h>\n"; }' "$f"
> done

Assuming you are on Unix. If on Windows, install Cygwin to get roughly the
same benefits as we Unix users have from a great commandline that lets us
automate such tasks easily.

M4

(No seriously, this question is one of those that can be easily solved on
Unix, but is pretty hard in plain Windows, even with Perl installed. I use
both every day intensively and know cmd.exe tricks that make even Windows
experts pause. Still after a (admittedly steep) learning curve, the Unix
command prompts are just so powerful, you'll never go back.)

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



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

Date: Fri, 1 Dec 2006 16:40:40 -0000
From: "Bigus" <bigus@abdcdefghijk.com>
Subject: Base64 MIME
Message-Id: <ekplu9$aqp$1@south.jnrs.ja.net>

I am trying to convert a base64 encoded string in a plain text mailing list 
archive file back into a document. I extract the string form the file and 
then decode it like this:

open DC, ">$path/$filename";
print DC decode_base64($encoded);
close DC;

where $encoded is the base64 string.

It creates the file, say a jpg or doc, of what looks like about the right 
size, but the images are corrupted. Is there anything obviously wrong with 
this?

Bigus 




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

Date: Fri, 1 Dec 2006 16:19:53 +0000
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: CPAN modules in commercial programs
Message-Id: <9a1644-d8a.ln1@osiris.mauzo.dyndns.org>


Quoth Sherm Pendley <spamtrap@dot-app.org>:
> "Shiraz" <shirazk@gmail.com> writes:
> 
> > can anyone point me to a resource or explain the requirements or
> > conditions that exists if one wants to use a module from CPAN in a
> > commercial software that i am going to sell.
> 
> In theory, CPAN modules are licensed independently according to whatever
> terms each module's author decides for themselves.
> 
> In practice, every module I'm aware of is licensed under the same terms
> as Perl itself - i.e. either GPL or Artistic License, your choice.

There are others: for instance, Locale::Maketext::Simple by Audrey Tang
is distributed under the MIT license.

Ben

-- 
I touch the fire and it freezes me,               [benmorrow@tiscali.co.uk]
I look into it and it's black.
Why can't I feel? My skin should crack and peel---
I want the fire back...                     Buffy, 'Once More With Feeling'


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

Date: 1 Dec 2006 07:05:32 -0800
From: "K.J. 44" <Holleran.Kevin@gmail.com>
Subject: Re: Date function
Message-Id: <1164985532.862806.163970@79g2000cws.googlegroups.com>

I am getting an error saying that it cannot find Date:Format in my
library so I need to add it in.  I have never installed a Perl Module
and am not exactly sure where to start.  I was at:

http://www.perl.com/CPAN/modules/01modules.index.html

I am not sure how to find what i need.  Thanks for any help.

Sharif Islam wrote:
> K.J. 44 wrote:
> > Hi,
> >
> > is there a date function in Perl or do I have to try to find a module?
> >
> > What i need is to be able to come up with the current date, then
> > subtract one day, and add that to the file name in the form of:
> >
> > YYYY-MM-DD-RestOfFileName.txt
> >
> > The script I have written parses these files and I want to run it every
> > night after midnight on the previous days file which has the naming
> > convention above.
> >
> > I am running ActiveState Perl in a Windows environment.
>
>
> You can use the Date::Format module.
>
> use strict
> use Date::Format;
> my $yesterday = time() - ( 24 * 60 * 60 );
> my $prefix= time2str("%Y-%m-%d", $yesterday);
> # YYYY-MM-DD-RestOfFileName.txt
> print $prefix."-RestOfFileName.txt"



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

Date: Fri, 01 Dec 2006 10:38:16 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Date function
Message-Id: <45705ad8$0$3567$815e3792@news.qwest.net>

K.J. 44 wrote:
> I am getting an error saying that it cannot find Date:Format in my
> library so I need to add it in.  I have never installed a Perl Module
> and am not exactly sure where to start.  I was at:
> 
> http://www.perl.com/CPAN/modules/01modules.index.html
> 
> I am not sure how to find what i need.  Thanks for any help.

First, since this is a separate question, use a more appropriate 
subject, e.g. "How to install modules". Second, please stop top-posting. 
  Third, to find the module, take a look at http://search.cpan.org/. 
Finally, to answer your question on how to install it, read the 
documentation for your installation or search the Internet on something 
relevant, such as 'perl "how to install module"', and you'd likely have 
found helpful documentation already.

ActiveState: 
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/ActivePerl-faq2.html

*nix: perldoc -q "How do I install a module from CPAN"


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

Date: Fri, 01 Dec 2006 12:13:48 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Date function
Message-Id: <m2ac27fsj7.fsf@Sherm-Pendleys-Computer.local>

"K.J. 44" <Holleran.Kevin@gmail.com> writes:

Upside-down. Please stop that.

> Sharif Islam wrote:
>> K.J. 44 wrote:
>> >
>> > I am running ActiveState Perl in a Windows environment.
>>
>> You can use the Date::Format module.
>
> I am getting an error saying that it cannot find Date:Format in my
> library so I need to add it in.  I have never installed a Perl Module
> and am not exactly sure where to start.  I was at:
>
> http://www.perl.com/CPAN/modules/01modules.index.html
>
> I am not sure how to find what i need.  Thanks for any help.

Since you're using ActiveState's Perl, the easiest way to install modules
is with their PPM (Perl Package Manager), documented here:

<http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/ActivePerl-faq2.html>

sherm--

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


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

Date: 01 Dec 2006 16:05:14 GMT
From: xhoster@gmail.com
Subject: Re: exec dynamic script, capture output, but see vars of caller?
Message-Id: <20061201110722.958$7S@newsreader.com>

"Stan R." <stan@invalid.blz/hmrprint/com.com> wrote:
> Hello, I've been tasked with writing a Perl program that generates
> another Perl script on the fly (by parsing a file, whose name is passed
> to the base script, that is basically a Perl program interweaved in a
> document, where the Perl code it inside special tokens (sorta kinda like
> how php looks like sitting among html markup.))
>
> I can very easily parse the page using a couple of s/// statements and
> such (god I love Perl's native RegEx :-) ) as needed and either execute
> with an eval() or dump the code into a file and execute it that.
>
> Now an additional requirement has been tasked on me. The parsed code
> needs to be able to 'see' global variables defined in the base script
> (most of which comes from a use'ed package lib.)
>
> I thought maybe I have solved this by simply dumping the parsed code
> into a file and using it with require, which /does/ work until there's
> an error in the code.

That sounds like a good reason not to use require.  But why not use eval
or do?

> I can check the syntax with `perl -c generatedscript.pl` but that's on
> compile time. I need to be able to catch runtime errors and warning as
> well, in addition to catching it's output, and if there are and errors
> or warning, they are to be output in sort of a notice instead of the
> output, alerting the end user to a problem in code in the processed
> file.

Did you have the warnings part worked before you discovered the require
didn't do what you want?  If so, why wouldn't that work with eval or do?

One way would be to do add something like this into the code you are
making:

local *STDERR;
open STDERR, ">wherever.err" or die $!;
local *STDOUT;
open STDOUT, ">whereever.out" or die $!;

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Fri, 01 Dec 2006 15:29:02 GMT
From: zentara <zentara@highstream.net>
Subject: Re: How can I change color font in GTK2?
Message-Id: <f3i0n2dd2uqj745m8o9iamk1bptru5smns@4ax.com>

On 30 Nov 2006 13:04:04 -0800, "robertospara" <robertospara@gmail.com>
wrote:

>I don't mean Label object but font in Entry or TextView object?
>Please for help and thanks from the mountains :)


For Entry:
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 '-init';

#the Entry settings in ~/.gtkrc-2.0 dosn't
#seem to do anything except create a subtle outline 
#under the entry box. So you need to manually make one. 

Gtk2::Rc->parse_string(<<__);

include "/usr/local/share/themes/Bumblebee/gtk-2.0/gtkrc"
style "normal" {
  font_name ="serif 30"
}

style "my_entry" {
  font_name ="sans 25"
  text[NORMAL] = "#FF0000"
}

widget "*" style "normal"
widget "*Entry*" style "my_entry"
__

my $window = Gtk2::Window->new;
$window->set_title("Hello world");
$window->signal_connect( destroy => sub { Gtk2->main_quit; } );

my $vbox = Gtk2::VBox->new();
$vbox->set( "border_width" => 10 );
$window->add($vbox);

my $label = Gtk2::Label->new("??????");
$vbox->pack_start( $label, 0, 0, 5 );    # expand?, fill?, padding

my $entry = Gtk2::Entry->new();
$vbox->pack_start( $entry, 0, 0, 5 );

my $button = Gtk2::Widget->new( "Gtk2::Button", label => "Quit" );
$button->signal_connect( clicked => sub { Gtk2->main_quit; } );

$vbox->pack_start( $button, 0, 0, 5 );

$window->show_all();
Gtk2->main;
__END__

#####################################################3
####################################################

for the textview, the only glitch to watch for is cursor color

#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';

Gtk2::Rc->parse_string(<<__);

style "my_text" {
font_name ="sans 24"
text[NORMAL] = "#FFAA00"
base[NORMAL] = "#000000"   
GtkTextView::cursor-color = "red"
}

style "my_cursor"{
fg[NORMAL] = "#FF0000"
}

widget "*Text*" style "my_text"
__

my $window = Gtk2::Window->new('toplevel');
$window->set_title('Z');
$window ->signal_connect( 'destroy' => \&delete_event );
$window->set_border_width(10);
$window->set_size_request(400,400);

my $vbox = Gtk2::VBox->new( FALSE, 6 );
$window->add($vbox);
$vbox->set_border_width(2);

my $hbox= Gtk2::HBox->new( FALSE, 6 );
$vbox->pack_end($hbox,FALSE,FALSE,0);

my $ebutton = Gtk2::Button->new_from_stock('gtk-quit');
$hbox->pack_end( $ebutton, FALSE, FALSE, 0 );
$ebutton->signal_connect( clicked => \&delete_event );

# Create a textbuffer to contain that string 
my $textbuffer = Gtk2::TextBuffer->new();
$textbuffer->set_text('yadda yadda yadda');

# Create a textview using that textbuffer 
my $textview = Gtk2::TextView->new_with_buffer($textbuffer);

# Add the textview to a scrolledwindow 
my $scrolledwindow = Gtk2::ScrolledWindow->new( undef, undef );
$scrolledwindow->add($textview);
$vbox->pack_start($scrolledwindow, 1, 1, 0 );

$window->show_all();

Gtk2->main;

#####################################
sub delete_event {
Gtk2->main_quit;
return FALSE;
}
#######################################
__END__







-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: Fri, 01 Dec 2006 11:24:08 +0000
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: how to do this with RE?
Message-Id: <usGdnfQetZBAje3YnZ2dnUVZ8sCdnZ2d@bt.com>

Arthur wrote:
> Andrew DeFaria дµÀ:
> 
>>Arthur wrote:
>>
>>>In fact I wasn't trying to move Willy to the right. Some of the 
>>>postings on my web forum are written as poems, with some lines like 
>>>that, so I just want to display the lines as intended. (Trailing 
>>>spaces cause problems if replaced with &nbsp; because very long lines 
>>>don't wrap properly.)

Maybe you should delete trailing spaces?

>>
>><pre>
>>
>>-- 
>>
>>Andrew DeFaria <http://defaria.com>
>>All women are idiots... and I married their queen.
> 
> 
> I considered <pre>, but PREed paragraphs don't seem to wrap?

Yes, you can't say it is preformatted (to preserve leading spaces) and
have line-endings not be preformatted too AFAIK.

Have you tried something like
  <div class="poem">

Then in your CSS something like
  #poem {
     margin: 20px 5px; border 2px dotted blue; padding: 10px;
     background: yellow;
     <etc etc>
  }

P.S. my CSS is probably pretty vile. This doesn't seem to be a Perl
question any more, so my apologies to the regulars :-)

Followups set to comp.infosystems.www.authoring.html because I don't
know of anywhere better


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

Date: Fri, 1 Dec 2006 13:37:38 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: how to do this with RE?
Message-Id: <ekpbb8.1do.1@news.isolution.nl>

Charles DeRykus schreef:
> Arthur:
 
>> What I want is to replace the leading spaces with &nbsp;
> 
> $foo = "   Willy";
> $foo =~ s/\G\s/&nbsp;/g;

Nice example of \G usage.

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Fri, 01 Dec 2006 15:29:01 GMT
From: zentara <zentara@highstream.net>
Subject: Re: I need to read web pages without LWP
Message-Id: <0nh0n2dmjj5m2kfvksi04fmrps8i3nl52e@4ax.com>

On Thu, 30 Nov 2006 19:11:22 GMT, Mark Healey <dont@like.spammers>
wrote:

>For years I was running a web host out of my living room to parse and
>digest some web pages for display on my Palm Pilot.  It got hacked and I
>got tired of doing all that maintenance so I bought a hosting account.
>
>The problem is that they only have the modules that came with Apache
>installed.
>
>The modules I used are CGI, LWP::UserAgent, HTTP::Request, HTTP::Response,
>URI::Escape.
>
>So what I need to do is have a script that takes form data and passes that
>to another sites form submission, takes the response, parses it for the
>data I want and responds with a page formatted for a really small screen.
>
>Can I do this without any modules and how hard would it be?

For pure Sockets, these worked when I last tested them.


#!/usr/bin/perl -w
# webget-client  192.168.0.1  /~zentara/index.html
use IO::Socket;
unless (@ARGV > 1) { die "usage: $0 host document ..." }
$host = shift(@ARGV);
foreach $document ( @ARGV ) {
$remote = IO::Socket::INET->new( Proto => "tcp",
PeerAddr => $host,
PeerPort => "http(80)",
);
unless ($remote) { die "cannot connect to http daemon on $host" }
$remote->autoflush(1);
print $remote "GET $document HTTP/1.0\n\n";
while ( <$remote> ) { print }
close $remote;
}
__END__



#!/usr/bin/perl
# Usage:  wwwgrab http://site.name.edu/ [filename]      #
#                                                       #
# ex.  wwwgrab http://www.engr.wisc.edu/~ballard/       #
# will get you the source behind my homepage and        #
# wwwgrab http://www.engr.wisc.edu/~ballard/pics/me.gif #
# will get you a .gif image of my picture.              #
#                                                       #
#########################################################
# Written by Jeff Ballard (ballard@cae.wisc.edu) 7/2/95 #
#              URL:  http://www.engr.wisc.edu/~ballard/ #
#########################################################
use warnings;
use Socket;

# Given an http address, rip it into its coresponding parts.

($_, $savefilename) = @ARGV;

if (!$_) {
  print "Usage:  $0 http://www.any.site/location [outputfilename]\n";
  print "  Where [outputfilename] is the optional filename to
create.\n";
  print "  (ommitting this means that it will mean that the data will
be\n";
  die "  sent to STDOUT.  If this file exists, it will
beoverwritten)\n";
}

/http:\/\/([^\/]*)\/*([^ ]*)/;
$site = $1;
$file = "/".$2;

if (!$site) {die "$0:  Fatal Error.  You appear to have munged your URL 
                   address.\nIt must be in the form of http://www.an\$"
}

$_ = $site;
/^([^:]*):*([^ ]*)/;
$site = $1;
$port = $2;
$port = 80 unless $port;

$hostname = $site;

#print STDERR "[$site] [$port] [$file]\n";

# Open a socket and get the data
($sockaddr,$there,$response,$tries) = ("Snc4x8");
$there = pack($sockaddr,2,$port, &getaddress($hostname));
($a, $b, $c, $d) = unpack('C4', $hostaddr);

$proto = (getprotobyname ('tcp'))[2];

if (!socket(S,AF_INET,SOCK_STREAM,$proto)) { die "$0:  Fatal
Error.$!\n"; }
if (!connect(S,$there)) { die "$0:  Fatal Error.  $!\n"; }
select(S);$|=1;
select(STDOUT);
print S "GET $file\r\n";
if ($savefilename) {
open(OUT,">".$savefilename) || die "$0: Fatal error.  Cannot create
$savefilename.\n";
}
while($line = <S>) {
if ($savefilename) {
print OUT $line;
} else {
print $line;
}
}
close(S);
if ($savefilename) {
close(OUT);
}

sub getaddress {
local($host) = @_;
local(@ary);
@ary = gethostbyname($host);
return(unpack("C4",$ary[4]));
}
__END__


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: 1 Dec 2006 13:00:17 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Regex failed to replace utf8 character
Message-Id: <4tanb1F131h9oU1@mid.dfncis.de>

Frank <mccownf@yahoo.com> wrote in comp.lang.perl.misc:
> Ben,
> 
> Thanks for your help. I was able to locate 3 problems with what I was
> doing:
> 
> 1) Reading the file into Perl using
> 
>   open(F, "<:utf8", $fn);
> 
> was the first problem.  Reading it in normally was what I should have
> been doing and was   doing originally, but I had added this later when
> trying to figure out what was going on.
> 
> 2) I should have replaced the copyright like you did:
> 
>   my $copy = "\xa9";
>   $html =~ s/$copy/C/g
> 
> 3) This still ran in an infinite loop:
> 
>   my $special = utf8::encode("Â");
>   print "sub\n" while ($html =~ s/$special / /g);

Ha!  You're not running under warnings and you didn't read the
pertinent documentation.  $special is undefined after this statement.
See perldoc utf8:

       * utf8::encode($string)
           Converts in-place the character sequence to the corresponding octet
           sequence in UTF-X.  The UTF-8 flag is turned off.  Returns nothing.

That also explains the infinite loop.

Anno


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

Date: 1 Dec 2006 05:42:33 -0800
From: "Frank" <mccownf@yahoo.com>
Subject: Re: Regex failed to replace utf8 character
Message-Id: <1164980553.842266.26410@j72g2000cwa.googlegroups.com>

> >   my $special =3D utf8::encode("=C2");
> >   print "sub\n" while ($html =3D~ s/$special / /g);
>
> Ha!  You're not running under warnings and you didn't read the
> pertinent documentation.  $special is undefined after this statement.
> See perldoc utf8:
>
>        * utf8::encode($string)
>            Converts in-place the character sequence to the corresponding =
octet
>            sequence in UTF-X.  The UTF-8 flag is turned off.  Returns not=
hing.
>
> That also explains the infinite loop.
>
> Anno

Nice- it's usually the most obvious explanations that get overlooked.

Frank



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

Date: 1 Dec 2006 06:06:16 -0800
From: "coffeevictim" <colin@yoursupport.biz>
Subject: RegEx variable isolation
Message-Id: <1164981975.969888.173380@73g2000cwn.googlegroups.com>

Hi,

I have an incorrect regex which seeks to add a column to a CSV file.
The new column always contains a "1" and is always the second to
last column.

My problem is that I don't know how to isolate the $1 from the 1 that
follows it so in my attempt it just looks like $11. Can anyone help?

$SOURCELINE =~ s/(.*,)$2/$11,$2/;

Thanks

coffeevictim



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

Date: Fri, 01 Dec 2006 15:27:24 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: RegEx variable isolation
Message-Id: <ekpede$haa$1@mlucom4.urz.uni-halle.de>

coffeevictim wrote:

> My problem is that I don't know how to isolate the $1 from the 1 that
> follows it so in my attempt it just looks like $11. Can anyone help?
> 
> $SOURCELINE =~ s/(.*,)$2/$11,$2/;
> 

  $SOURCELINE =~ s/(.*,)/${1}1,/;

Regards

M.




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

Date: 1 Dec 2006 07:36:03 -0800
From: "coffeevictim" <colin@yoursupport.biz>
Subject: Re: RegEx variable isolation
Message-Id: <1164987362.986197.303240@79g2000cws.googlegroups.com>


Mirco Wahab wrote:
> coffeevictim wrote:
>
> > My problem is that I don't know how to isolate the $1 from the 1 that
> > follows it so in my attempt it just looks like $11. Can anyone help?
> >
> > $SOURCELINE =~ s/(.*,)$2/$11,$2/;
> >
>
>   $SOURCELINE =~ s/(.*,)/${1}1,/;
> 
> Regards
> 
> M.

Cheers M.

cofffeevictim



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

Date: 1 Dec 2006 03:33:13 -0800
From: ragavendran31@gmail.com
Subject: unable to use @ARG in Perl
Message-Id: <1164972793.092676.200780@j72g2000cwa.googlegroups.com>

Hi all,

While i try 2 execute this prgm im getting output as  Zero..... i didnt
get clear info abt @ARGV so can anyone help me reg this .... but in
notes its saying that in commandline v shd give sme inputs for sum ...

My Program is as Follows :

my $tot = 0;
$tot += $_ for @ARGV;
print"the total is $tot\n";

Thanks in advance.

By,
Ragavendran R



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

Date: Fri, 01 Dec 2006 11:54:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: unable to use @ARG in Perl
Message-Id: <Xns988C46631481Dasu1cornelledu@127.0.0.1>

ragavendran31@gmail.com wrote in
news:1164972793.092676.200780@j72g2000cwa.googlegroups.com: 

> While i try 2 execute this prgm im getting output as  Zero..... i
> didnt get clear info abt @ARGV so can anyone help me reg this 

We could try to help you 'reg this' if we knew what it meant to 'reg' 
something.

> .... but in
> notes its saying that in commandline v shd give sme inputs for sum ...

What is commandline v? What do you mean by "shd give sme"? Please write in 
proper English. It is the language that is common to all of us on this 
forum. Making it easy for others to understand what you mean, would help 
you get help.

> My Program is as Follows :
> 
> my $tot = 0;
> $tot += $_ for @ARGV;
> print"the total is $tot\n";
> 

Please show exactly how you run the program and exactly what output you 
get.

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://augustmail.com~tadmc/clpmisc/clpmisc_guidelines.html


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

Date: Fri, 01 Dec 2006 12:26:54 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: unable to use @ARG in Perl
Message-Id: <icVbh.14877$_x3.3599@trndny02>

ragavendran31@gmail.com wrote:
> While i try 2 execute this prgm im getting output as  Zero..... i
> didnt get clear info abt @ARGV so can anyone help me reg this ....
> but in notes its saying that in commandline v shd give sme inputs for
> sum ...

I realize that English is probably not your first language, but in 
particular if you are not familiar with the language _PLEASE_ run your 
posting through a spell checker before hitting the send button.
To me what you wrote above is mostly gibberish and at least I can not really 
make any sense of it.

Thank you for your consideration.

jue 




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

Date: Fri, 01 Dec 2006 09:44:42 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: unable to use @ARG in Perl
Message-Id: <011220060944424891%jgibson@mail.arc.nasa.gov>

In article <1164972793.092676.200780@j72g2000cwa.googlegroups.com>,
<ragavendran31@gmail.com> wrote:

> Hi all,
> 
> While i try 2 execute this prgm im getting output as  Zero..... i didnt
> get clear info abt @ARGV so can anyone help me reg this .... but in
> notes its saying that in commandline v shd give sme inputs for sum ...
> 
> My Program is as Follows :
> 
> my $tot = 0;
> $tot += $_ for @ARGV;
> print"the total is $tot\n";

wrx 4 me:

jim 39% cat sum.pl
#!/usr/local/bin/perl
use strict;
use warnings;
my $tot = 0;
$tot += $_ for @ARGV;
print"the total is $tot\n";
jim 40% sum.pl 1 2 3 4
the total is 10
jim 41% 

gd lk! c u l8r!


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

Date: Fri, 1 Dec 2006 14:43:52 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: using DateTime object
Message-Id: <ekpfco.14c.1@news.isolution.nl>

Dr.Ruud schreef:

> For ActivePerl on Windows, see the make-route as the last resort.
> Just add the Winnipeg (and maybe the Roth) repositories to your ppm
> and go from there.
> Very convenient.

But also consider this:

"Getting Fed Up with ActiveState" 
  http://www.perlmonks.org/?node_id=587162 

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

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


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