In general, I would urge you to read the built-in functions for strings and
scalars in the Perl documentation.
That said, an easy way to get the first fifty characters of a string (ie a
substring of a string) use
my $substring = substr($row, 0, 50); # $row is the string, 0 is the
starting point, 50 is the amount of characters we want to get out
This has the advantage of not affecting $row if you want to use it
later. Also, if $row is shorter than fifty characters, you'll get $row back.
You mention having a variable @row. That would be an array, which, unlike
C, is not a string. If a variable called 'row' should contain a string
representing one row in a database, then you should refer to it as a
scalar, ie $row.
Not sure if this is exactly what you want but I hope it points you in the
right direction.
At 13:43 18.06.2001 -0400, Brian Jackson wrote:
>I am completely new to Perl.
>
>I am trying to figure out how I can parse a row, character by character,
>that I have retrieved from a database. I would like to format output
>based on characters from the row. For example I may have retrieved 250
>character string from a database and I want to print that character
>string, BUT I want to print only 50 characters a line or less. How
>might I do this if I have a variable called @row??
Aaron Craig
Programming
iSoftitler.com