PERL to PHP
| From: | Clayton Dukes | Date: | Mon, 26 Feb 2001 14:58:53 +0000 |
| Subject: | PERL to PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-41687@lists.php.net to get a copy of this message | ||
Hi :-)
Can someone tell me how to do the equivalant of this Perl script in PHP?
###
### This function prints all lines between the dashes read in a text file
###
### The file looks like this:
# -----------------------------
# Somedata: something
# Someother: something else
# ------------------------------
#
# Several paragraphs
# Several paragraphs
# Several paragraphs
# ----------END--------------
#
#!/usr/bin/perl -w
@rray = <STDIN>;
$inside = 0;
foreach $line (@rray) {
if ($line =~ /-----/ig) {
$inside = 1;
} elsif ($line =~ /-----/gi) {
$inside = 0;
}
if ($inside == 1) {
print $line;
}
}
TIA!
Clayton Dukes
CCNA, CCDA, CCDP, CCNP
Internetwork Solutions Engineer
Internetwork Management Engineer
Thrupoint, Inc.
Tampa, FL
(c) 904.477.7825
(h) 904.292.1881