define, like constant, is used at compile-time; hence, it has to be declared before any run. In this case, it really doesn't need to be used, but I used it to for debugging. The result might surprise you.
#!/usr/bin/perl use Modern::Perl '2012'; use strictures 1; no strict 'refs'; use Spreadsheet::ParseExcel; use Devel::SimpleTrace 'showrefs'; use define DEBUG => 1; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('tags sample.xls'); my $page = $workbook->{Worksheet}[0]; my ( $tags, $pages, $pviews, $pvisits ); format STDOUT_TOP = Tags Pages Page Views Page Visits . format STDOUT = @<<<<<<>>>>>>>>> @ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $tags, $pages, $pviews, $pvisits . my %i; foreach ( my $i = 0 ; $i{'MaxRow'} ; ++$i ) { $tags = cell( $page, $i, 0 ); $pages = cell( $page, $i, 1 ); $pviews = cell( $page, $i, 2 ); $pvisits = cell( $page, $i, 3 ); write; } cell(DEBUG); sub cell { my ( $Wks, $r, $c ) = @_; if ( defined( $$Wks{'Cells'}[$r][$c] ) ) { my $val = $$Wks{'Cells'}[$r][$c]->Value; chomp $val; return $val; } return ''; }

In reply to Re: Can't locate define.pm by Khen1950fx
in thread Can't locate define.pm by jaldama

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.