rammohan has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Reading a single column from csv using perl
by marto (Cardinal) on Feb 08, 2014 at 10:25 UTC

    Why do you load Text::CSV, you don't use it. Your data is not comma seperated, why are you using this as a separator? You've been given many working exaples for reading files. Look at them, compare it to your use of open. What do you notice? Your code does not have 15 lines (as per your error message), and as posted does not recreate the problem you claim. How do I post a question effectively?, and as usual you posted in the wrong place Where should I post X?.

    Update: You don't need both

    #!/usr/bin/perl -w

    and

    use warnings;

    Update: fixed typo.

Re: Reading a single column from csv using perl
by choroba (Cardinal) on Feb 08, 2014 at 10:16 UTC
    This is not an error, it is a warning.

    Your data do not seem to be comma separated, but the script sets $column_separator to qr/,/.

    Also, please check the closing code tag. It is missing a slash.

    Update: use Text::CSV is a step in the right direction. The script does not profit from the module in any way, though.

    Update 2: To read from a file, you have to open it for reading, not appending.

    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: Reading a single column from csv using perl
by MidLifeXis (Monsignor) on Feb 10, 2014 at 14:12 UTC

    To echo what marto states above, you do not need both #!perl -w and use warnings. In fact, they do slightly different things.

    • #!perl -w causes warnings to be turned on for the duration of the program, through all included modules, even those not using the warnings pragma. This can generate warnings from modules that you have no control over.
    • use warnings will turn on warnings from the point of the pragma directive until the close of the file, the close of the enclosing block (if included within {...}), or a no warnings pragma directive (subject to scoping rules).

    I personally would stick with use warnings and dump the -w from your shebang line.

    --MidLifeXis

Re: Reading a single column from csv using perl
by rammohan (Acolyte) on Feb 08, 2014 at 10:20 UTC
    how to resolve this error? sorry i changed append to +<