Dear almut. yes you are right.
i just try to pass $incomedata in to the sub.
which is part of cookie .
and i save it as a sting
in mysql db.
but i know it looks like below without square brackets
$VAR1 =
{
'quantity' => 1,
'name' => 'abc1'
},
{
'quantity' => 2,
'name' => 'abc2'
}
should i format it to
$VAR1 = [ {
'quantity' => 1,
'name' => 'abc1'
},
{
'quantity' => 2,
'name' => 'abc2'
}
];
is it a string format?
sorry for my silly queestion .
is it ok to pass a string to the sub ?
the scirpt is taken partially from sample code of cgi::session cookbook
http://search.cpan.org/~sherzodr/CGI-Session-3.94/Session/CookBook.pm
sub display_cart {
my ($cgi, $session) = @_;
# getting the cart's contents
my $cart = $session->param("CART") || [];
my $total_price = 0;
my $RV = q~<table><tr><th>Title</th><th>Price</th></tr>~;
if ( $cart ) {
for my $product ( @{$cart} ) {
$total_price += $product->{price};
$RV = qq~
<tr>
<td>$product->{name}</td>
<td>$product->{price}</td>
</tr>~;
}
.............the rest of code has been omitted from here
i will give it a try after right after my pc is back to normal according your advice.
thank you very much
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.