Hi, > I'm developing a basic data base tool. The "search > engine" I'm trying to impliement will read single > characters from the source file (where data is stored > in :dataø format). I assign every single character > between the start ':' marker to the end 'ø' marker. > Then, I try to turn the array of characters into a > string variable like this: $user[$y]= $data[0..$x], > where $y is the matrix entry where I want to insert > the string, and $x is the number of characters read > by the function...
That sounded terribly complicated, and unfortunately I don't think I can reliably extract the problem from the words. The problem, as I understand, is: You have a file like: :The characters that you wantø :are stored in a format ratherø :like this.ø And you want to turn it into a string like: "The characters that you want are stored in a format rather like this." My version of the solution looks like: --- SCRIPT START --- my @data; while ( <FILE> ) { # Skip lines unless we have a data line next unless /^\s*:/; next unless /ø\s*$/; # Remove start/end characters from data line s/^\s*://; s/ø\s*$//; # Put the data line in an array. push @data, $_; } my $string = join "", @data; --- SCRIPT END --- Obviously you need to need to open and close the file, since I've omitted the code to do that. This is one solution, perhaps not the fastest either... you'd need to benchmark it against other solutions - of which I can think of several (including greps, maps, a single regexp). Email me a sample file and I'll write a few of them :) Take care, Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]