Pablo Fischer wrote:
> Thanks!!!
>
> That's what I was looking for!
>
> Yep, the file has a single record, It works, thanks!
>
> Now looking your code, the difference its the local $/. What does local $/ its
> doing?

The scalar $/ is a perdefined variable which is the 'input record
separator'. It is set to "\n" by default, so

  my $line = <FILEHANDLE>;

will read everything from the filehandle up to the next newline. Setting
it to 'undef' hash the effect of disabling records altogether, so the
next read will fetch the entire file. The line

  local $/;

is an idiomatic way of saying

  $/ = undef;

and, if you want to write it even more explicitly

  use IO::Handle;
  IO::Handle->input_record_separator(undef);

You can set the value to anytyhing you want, so you could write

  $/ = '|'

then every time you read from the filehandle you will get the next field
up to (and including) the pipe.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to