NAME
File::Index - an index function for files
SYNOPSIS
use File::Index;
open(FILE,$myfile);
my $pos=indexf(*FILE,"Foo");
print "Foo found at position: $pos\n" if $pos > -1;
open(FILE2,$myfile2);
my $pos2=rindexf(*FILE2,"Bar");
print "Bar found at position: $pos2\n" if $pos2 > -1;
DESCRIPTION
This module provides the indexf and rindexf functions which operate on files in the same way that the index and rindex functions operate on strings. It can be used where memory limitations prohibit the slurping of an entire file.
indexf( *FH, $string, [$start], [$buffersize] )
-
Starts at the position specified by '$start' (or at the beginning) of the file associated with filehandle 'FH', and returns the absolute start position of the string '$string'. The buffer-size can be adjusted by specifying '$buffersize'.
rindexf( *FH, $string, [$position], [$buffersize] )
-
Returns the position of the last occurrence of '$string' in the file associated with filehandle 'FH'. If '$position' is specified, returns the last occurrence beginning at or before '$position'.
The buffer-size can be adjusted by specifying '$buffersize'. If you wish to specify a '$buffersize' value without specifying a '$position' value, use a negative value (e.g. '-1') for the latter.
AUTHOR
Graham Jenkins, <grahjenk at cpan.org>
BUGS
Please report any bugs or feature requests to bug-file-index at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Index. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc File::Index
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2012 Graham Jenkins.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.