--- Rene Verharen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In one of my scripts I do a search and replace like this
> :
>
> $text =~ s/$search/$replace/;
>
> This works fine, but if $search or $replace contains
> one or more words between round brackets () it doesn't
> what I had in mind :
>
> 1. Why doesn't "use strict" complain about the $1 not
> being declared?
$1, $2 etc are locally scoped variables which come from the
regex. A regex like:
m/(..)(.*)/
will place the first two characters into $1, and the rest
into $2 - according to the parathesis.
> 2. How can I filter ALL of
> I made a script that show /var/log/messages* when you
> press submit. But!!! It doesn't come out to the last
> when the file size is upper than the few MB.
>
> ... [SNIP] ...
>
> if ( $q->param( "show" ) ) {
> open( LOG, $q->param( "check" ) );
> @log = ;
> close( LOG );
> }
> I' d like to know if it' s possible to print the number
> of occurences of letter "o" inside a variable string,
> using perl function map.
$qty = $string =~ tr/o/o/;
Shortest and seemingly the fastest solution.
Jonathan Paton
__
Do You Yaho
> Our web server enables us to use 'SafePerl' for
> CGI scripts. I can find little information relating
> to this, and what subset of Perl commands are
> enabled (or correctly, which commands are disabled).
> Can anyone point me in the right direction?
You are probably looking for the "Safe" modu