1.What are the different ways to initialize a variable. How
to differentiate global and local variables, explain it
through a simple tcl program.

2.Create a list of week days and print the first and last
character of each day using foreach command

3.Can you write a small program to verify the given input is
file or directory.Before checking, just ensure that the
file/dir exists or not in the given path. If the given
input is a file, findout the size and verify that the file
has all read ,write and execute permission.

Answer Posted / devendra singh bhadoriya

2. % set days {monday tuesday wednasday thursday friday
saturday sunday}
monday tuesday wednasday thursday friday saturday sunday
% foreach day $days {
set str [split $day ""]
puts "[lindex $str 0]"
puts "[lindex $str end]"
}

Is This Answer Correct ?    17 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi all, Is there any certification exams available for TCL and Perl. If so please let me know, my mailid is vpbharathi@gmail.com. Thanks in advance, Bharathi.P

2529