How to split a string read from the file?



dear all , I'am trying to write a script to neaten files as follows:

1 : #!/usr/local/bin/perl
2 :
3 : while ($inputline = <STDIN>) {
4 : while ($inputline =~ /\b[A-Z]\S+/g) {
5 : $word = $&;
6 : $word =~ s/[;.,:-]$//; # remove punctuation
7 : for ($count = 1; $count <= @wordlist;
8 : $count++) {
9 : $found = 0;
10: if ($wordlist[$count-1] eq $word) {
11: $found = 1;
12: $wordcount[$count-1] += 1;
13: last;


I want to clear the number and colon at the beginning of each line and wirte
a perl script

#/usr/bin/perl -w
use strict ;

open MYFILE , "my.txt" ;
my @array=<MYFILE>;
my $count=0;
my @temp;
my $sum=0;

for($count=0;$count lt @array ; $count++){
(my $number,$temp[$sum])=split (/:/,$array[$count]);
print $number,"\n";
$sum++;
}


print @temp;


but the output just three lines instead of 17


--
Terry Pang


Relevant Pages

  • Re: Thermal Monitor & automatic shutdown on over temperature event
    ... My reading has led me to believe that the kernel can do at least the CPU ... > I wrote this small script using sensors to detect and warn high temps. ... I run the script with nohup. ... > echo temp OK: $TEMP ...
    (Debian-User)
  • [Full-Disclosure] Another IE trick (Re: IE sucks : sun java virtual machine insecure tmp file creati
    ... Internet Files") with content of the script file. ... Exploitation of "Temp" folder content may be really interesting issue. ... And _real_ bug is one pointed by Http-equiv. ...
    (Full-Disclosure)
  • Improving a Contact-from-text script
    ... (I'm placing the script below). ... set firstname to words 1 thru -2 of aLine ... repeat with i from 2 to cnt ... set temp to every word of aLine ...
    (microsoft.public.mac.office.entourage)
  • Re: colon
    ... :> ensures that the last command does not leave a non-zero exit code. ... While I would have said that the colon was used to comment ... The script would core dtksh, but nothing appeared wrong in it. ...
    (comp.unix.shell)
  • Re: Classes and global statements
    ... Scott David Daniels skrev: ... that I need several variables returned to the main script. ... Break up the assignment and insert prints: ... print "I'm going to expand the triple:", temp ...
    (comp.lang.python)