ok here i go i have the following code!
@files = <../data/texts/*.txt>;
print start_form(-action=>"index.pl");
print p( {-align=>'center'}, font( {-size=>5, -color=>'Lime'}, 'Λόγ
+ος Ψυχωφελής και Θαυμάσιος ---> ' ),
popup_menu( -name=>'choice', -values=>
+\@files ),
submit('ok'));
print end_form(), br();
if ( $file = param("choice") )
{
open(FH, "$file") or die $!;
@data = <FH>;
close(FH);
$data = join("", @data);
}
I want the arrray @files = <../data/texts/*.txt>; who gives filanes like this ../data/texts/file1.txt
to conever its values to file, file2,file3 and so on. to remove the path and the .ext that is.
Why? because i want to display the arrays values to a popup menu without the path and the extension.
Then before this line open(FH, "$file") or die $!; o want the array to be re-converted to its origianl state so that the file could actually open. This rquires s/// operator in my opinion but i dont knwo how to write it. Thanks!
The Devil Is In The Details!
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.