Hi ml,

I find you hard to understand, but I'll try.

On Sat, 10 Mar 2012 03:06:27 +0100
ml <m...@smtp.fakessh.eu> wrote:

> hello the list
> hello "the" perl guru
> hello this
> 
> I want to know how to work on slices of lists. 
> I has 3 slices of the form.
> $t[0] = user;
> $t[1] = ip; 
> $t[2] = time();

First of all, $t[0], $t[1] and $t[2] are not slices of a list,  but *elements*
of the *array* variable "@t". Slices are something like @arr[4 .. 10] or
@arr[@indexes]. Otherwise, you should generally avoid using arrays for such data
of heterogeneous types and kinds, and instead use objects or at least hashes.

See:

* http://perl-begin.org/topics/object-oriented/

* http://perl-begin.org/topics/hashes/

> 
> the registration of the list are checked by me

Do you mean that you check that the list is properly populated. 

> I know what the file contains
> and recording are separated by a space (/\s+/)

Should it be "records" instead of "recording"?

> I would like to test on how many times a user or an ip c is connected
> via the time value and authorize or not the execution of the following
> function
> 
> I'd like to explain to me how to do testing on lists and list slices
> 

You can use any of the Perl operators and functions that operate on lists and
arrays like "foreach", http://perldoc.perl.org/functions/grep.html ,
http://perldoc.perl.org/functions/map.html or 
http://search.cpan.org/perldoc?List::Util ,
http://search.cpan.org/dist/List-MoreUtils/ , 
http://search.cpan.org/dist/List-UtilsBy/ ,
etc.

There's more information about it in the books and tutorials on
http://perl-begin.org/ and on http://perl-tutorial.org/ .

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Rethinking CPAN - http://shlom.in/rethinking-cpan

Chuck Norris is the ghost author of the entire Debian GNU/Linux distribution.
And he wrote it in 24 hours, while taking snack breaks.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to