PHP: strcmp($foo, $bar) strcasecmp($foo, $bar)
Perl: index($foo, $bar) index(lc $foo, lc $bar)
PHP: strpos($foo, $bar) stripos($foo, $bar)
Perl: $foo =~ s/foo/bar/ $foo =~ s/foo/bar/i
PHP: $foo = str_replace('foo', 'bar', $foo) $foo = str_ireplace(...)
PHP: $foo = ereg_replace('foo', 'bar' ,$foo) $foo = eregi_replace(...)
# use of index function in perl
#!/usr/bin/perl
use strict;
use warnings;
my $string = 'perlmeme.org';
my $char = 'l';
my $result = index($string, $char);
print "Result: $result\n";
This program gives you:
Result: 3
댓글 없음:
댓글 쓰기