Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I join two variables to create a folder name?
    primarykey
    data
    text
    <p>What I'm trying to do is create a folder at a designated location and then name that folder with the date and the users initials. I want the user to be able to input the initials when creating the folder. I have figured out how to generate the date in the correct format but I need to figure out how to add the user input $initials together so that the folder name is something like this "130506SS". I can't figure out how to join these two variables together to get the correct folder name. Can anyone help me figure this out? </p> <pre><code> use strict ; use warnings ; use POSIX qw(strftime); my $mydate = strftime("%y%m%d",localtime(time)); #puts the year month date and time in the correct format for the folder name print "Enter users initials: "; my $initials = &lt;STDIN&gt;; # prompts for user input #$mydate.= "SS"; #stores today's date and the initials $mydate.= $initials; sub capture { my $directory = '/test/' . $mydate; unless(mkdir($directory, 0777)) { die "Unable to create $directory\n"; } } capture(); #creates the capture folder sub output { my $directory = '/test2/' . $mydate; unless(mkdir($directory, 0777)) { die "Unable to create $directory\n"; } } output(); #creates the output folder </code></pre> <p>Edit: The entire portion of the above script works except where I'm trying to join the two variable to create the folder name. ($mydate.= $initials;) I've tested it with ($mydate.= "SS";) instead and the script works perfectly. I can manage to join the variable $mydate and a string but not $initials. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload