> Is there a perl function that reads one character at a time from a
> string and and returns that character? Something like the following:
> $Line = some string;
> foreach ($Line){
> $char=read_char($_);}
>
> Thanks,
> Dick Fell
I am not positive what you are really wanting here...
my $Line = s
I can't check this right now, but I believe you can do it like this:
$Line = "some string";
@array = split //,$Line; #split on null
foreach(@array){
$char = read_char($_);
}
-Original Message-
From: richard noel fell
To: [EMAIL PROTECTED]
Sent: 3/3/02 6:28 PM
Subject: reading one c
> Is there a perl function that reads one character at
> a time from a string and and returns that character?
There are VERY FEW situations that require this kind of
action... but assuming you have one then the well proven
shortest approach is:
$string = "Hello World";
@string = $string =~ /./g;
ay, March 04, 2002 1:29 PM
To: [EMAIL PROTECTED]
Subject: RE: reading one character at a time
> Is there a perl function that reads one character at
> a time from a string and and returns that character?
There are VERY FEW situations that require this kind of
action... but assuming you hav
I don't think that applies to split(), however. In this case it works works
works! :)
-Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 04, 2002 10:55 AM
To: 'Jonathan E. Paton'; [EMAIL PROTECTED]
Subject: RE: reading one char
--- Nikola Janceski <[EMAIL PROTECTED]> wrote:
> actually searching on a empty pattern is wrong wrong
> wrong! A pattern in a search that evalutes to "" will
> use the previous successful pattern match.
Lets see what I actually said:
| Split on a null length string is probably more
| readable,
> -Original Message-
> From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
> Subject: RE: reading one character at a time
>
> I can't check this right now, but I believe you can do it like this:
>
> $Line = "some string";
> @array = split //,