Hows about
my $sz='?:\\dir\\myfile.ini';
foreach my $ch (c..z) {
substr($sz,0,1)=$ch;
...
}
my $sz='A string';
foreach my $ch (split(//,$sz)) {
print "$ch\n";
}
Gary
On Friday 13 July 2001 12:09 pm, Busse, Rich wrote:
> In C, I can do something like this:
>
> char ch ;
> char sz [] = "?:\\dir\\myfile.ini" ;
> for ( ch = 'c' ; ch <= 'z' ; ch++ )
> {
> sz[0] = ch ;
> . . .
>
> to spin thru all the possible drives on a Windows NT box. But Perl
> complains about trying to compare/increment a non-numeric. Any way around
> this?
>
> Also, to look at each character in a string, I can do:
>
> int i ;
> char sz [] = "A string" ;
> for ( i = 0 ; i < strlen (sz) ; i++ )
> {
> ch = sz [i] ;
> . . .
>
> How do I access each character in a string with Perl? TIA...
--
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000