Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 05-09-2009, 03:27 PM   #1
Member (9 bit)
 
darkside's Avatar
 
Join Date: Jul 2003
Location: Sheffield, UK
Posts: 292
perl - Stuck on something that seems simple.

OK, im following some random guide thing on the net, just out of curiosity more than anything. I wanted to see how perl worked, and how different it was to other stuff that ive dabbled with.

Anyway, on the first 'chapter' it wants me to..
# Write a program that prints its own source code using a back-quoted string.

Now, it gives an example
print "dir *.txt";

Which is supposed to list all the text files in the current directory i assume. When i tap this into bash, it works just fine. but it doesnt work in my perl script. It literally returns 'dir *.txt' but without the 's.

Ive tryed a few different commands, and all i get is the same thing. it prints what im typing. Now , as the risk of sounding like an idiot, what is a back quote? All i have on my KB is " and '.

Im stuck for ideas now so have come you you guys for some help, anyone know what im doing worng here? Its bugging me now lol.
Nathan
darkside is offline   Reply With Quote
Old 05-09-2009, 08:41 PM   #2
Barefoot on the Moon!
Staff
Premium Member
 
Force Flow's Avatar
 
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
The backquote is on the tilde key (the one below the escape key that you never use).

So, I'm guessing what you want looks like this:

Code:
print `dir *.txt`;
__________________
There are two secrets to staying young, being happy, and achieving success. You have to laugh and find humor every day, and you have to have a dream.
Force Flow is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:41 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2