Fello Monks

Given this code snippet:

sub home { my $self = shift; my $html_template = $self->param('html_template'); my $cgi = CGI->new; my $session = $cgi->param('session'); my $empty; my $user_status; my ($session_id, $last_action_date, $last_action_time) = $session =~ + /^(\d\d)-(\d{10})-(\d{8})$/; my $datetime = Class::Date->now(); $datetime =~ tr/://d; my ($now_date, $now_hour, $now_min, $now_seconds) = $datetime =~ /^ +(\d{8}) (\d{2})(\d{2})(\d{2})$/; my $output; $html_template->process('home', { wrapper => $self->wrapper(), session => $session, user_status => $user_status, session_id => $session_id, now_date => $now_date, now_hour => $now_hour, now_min => $now_min, now_seconds => $now_seconds, session_id => $session_id, last_action_date => $last_action_date, last_action_time => $last_action_time, }, \$output) || die $html_template->error; return $output; }

Why wont all the now_ variables display on the relevant template when they are called in the template correctly?

In my Base.pm, I do something similar, but the varibles (now_ in the snippet) are put into an array, and used from there as an array

So my understanding is that the variables in the my (), are an array, so how can the array be split up, or am I approaching this wrong?

Update: And same question regarding the $session "split" with session_id, last_action_whatever, where $session is a string of numbers (say 00-0000000000-00000000)

Update: So wht i want to do is take $session, and put the first 2 digits/chars. into $session_id, then next 10 into $last_action_date, then the next 8 into $last_action_time, and use them on the page/in the rest of the function, and I dont care if my $session layout os wrong, Coz the question will still stand!

Yours

FINAL UPDATE: All Sorted thanks to the Split Function suggested by ptum, its all I wanted to do was Split up a $memory and put the split bits into $other_mems

Barry Carlyon barry@barrycarlyon.co.uk

In reply to Large Variable to small variables, why dont they display by barrycarlyon

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.