Home  |  Linux  | Mysql  | PHP  | XML
From:Shlomi Fish Date:Fri Feb  5 11:09:37 2010
Subject:Re: 1-line text file with numbers, need to add to them
Hi Frank!

On Thursday 04 Feb 2010 19:24:41 Frank wrote:
> For instance, the below is your data file --data.txt
> 12~s1~s314~s5677~s899~s0~s
> Here are the codes:
>
> #!/usr/bin/perl
> open(DATA,"data.txt");
> while(<DATA>) {
> $number=$_;
> # print $number;
> while ($number =~ /([0-9]+)~s/g){
> printf ("%d\n","$1");
> }
> }
> close(DATA);
>

This code snippet is wrong on so many levels:

1. No "use strict;" and no "use warnings".

2. No three-args open , lexical filehandles and a trailing "or die".

Why did you post this to the list, possibly misleading other people, when you
don't know the Modern Perl conventions?

Regards,

Shlomi Fish


--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .
Navigate in group perl.beginners at sever nntp.perl.org
Previous Next


Your recent visits
Re: stripped output from Net::SSH2
Modeling FIFO financial transactions in Perl
Re: Can anybody explain me what this shebang line is doing?
use with variable
Re: use with variable



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants