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 . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/