Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Output to another file help

by roboticus (Canon)
on Nov 08, 2012 at 21:21 UTC ( #1002986=note: print w/ replies, xml ) Need Help??


in reply to [SOLVED] Output to another file help

jaffinito34:

You're treating $firstName as an array reference, but it's presumably a string. What you want to do is create a variable that holds the first initial, then you can print that. Something like this:

my $firstName = 'Marco'; my $firstInitial = substr($firstName, 0, 1); print "First initial is '$firstInitial'\n";

Read the documentation for substr to see how it works.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Output to another file help
Select or Download Code
Re^2: Output to another file help
by jaffinito34 (Acolyte) on Nov 08, 2012 at 21:36 UTC

    PERFECT!, any ideas how to quickly convert the firstInitial to lowercase? Right now my script outputs the first initial, first 3 of the last name, and last 4 of ssn, but it does so that it looks like this:

    First, Last, 000-000-0000, etc...

    output: FLas0000

    I'm trying to get it like: flas0000

Re^2: Output to another file help
by jaffinito34 (Acolyte) on Nov 08, 2012 at 21:39 UTC

    Nevermind, found out about lc() function.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002986]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-07-31 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (254 votes), past polls